Skip to content

Commit 4386c3f

Browse files
authored
Add files via upload
1 parent f6921c7 commit 4386c3f

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

String/Palindrome.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def palindrome(str):
2+
return str == str[::-1]
3+
4+
str=input("Enter The string")
5+
ans= palindrome(str)
6+
7+
if ans:
8+
print("YES")
9+
else:
10+
print("NO")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
str=input("Enter The string")
2+
print(str)
3+
i=int(input("Enter The position you want to remove"))
4+
new_str= str[:i]+str[i+1:]
5+
print(new_str)

String/Reverse words.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def reverse(sentence):
2+
words= sentence.split(' ')
3+
reverse_sentence= ' '.join(reversed(words))
4+
return reverse_sentence
5+
6+
sentence = input("Enter the sentence")
7+
print(reverse(sentence))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def check(string, sub_string):
2+
if (string.find(sub_string) == -1):
3+
print("No")
4+
else:
5+
print("Yes")
6+
7+
string= input("Enter the string")
8+
sub_string= input("Enter The sub-string")
9+
check(string, sub_string)

0 commit comments

Comments
 (0)