forked from fenyx-it-academy/Class4-PythonModule-Week3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5- equal_reverse.py
More file actions
20 lines (17 loc) · 889 Bytes
/
5- equal_reverse.py
File metadata and controls
20 lines (17 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Write a function that controls the given inputs
# whether they are equal to their reversed order or not.
# Example:
# Input >>> madam, tacocat, utrecht
# Output >>> True, True, False
def palindrom(args): # Name and parameter of function
result=""
for word in args: # list elements will be visited
reversed_word = word[::-1] # will be checked if it is a palindrom
if word == reversed_word: # If palindrom True
result += ("True, ")
else:
result += ("False, ") # If not False answer will be returned
return result
original_word = input ("Enter words seperated with only comma sign ',' :")
mylist = original_word.split(",")
print(palindrom(mylist)) # Calling function