We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d8841b commit 9ed1c4bCopy full SHA for 9ed1c4b
1 file changed
string_palin.py
@@ -0,0 +1,20 @@
1
+#
2
+
3
+# With slicing -> Reverses the string using string[::-1]
4
5
6
+string= input("enter a word to check.. ")
7
+copy=string[::-1]
8
+if string == copy:
9
+ print("Plaindrome")
10
+else:
11
+ print("!")
12
13
+# Without slicing –> Reverses the string manually using a loop
14
+reverse_string=""
15
+for i in string:
16
+ reverse_string=i+reverse_string
17
+if string == reverse_string:
18
+ print(reverse_string)
19
20
0 commit comments