• Check String Palindrome:
s=input() O/P:
s=s.replace(" ","").lower() Input:
if s==s[::-1]: race a car
print("Yes") Actual Output:
else: No
print("No")
• Remove Word from String:
O/P:
Input:
apple apple apple
apple
Expected Output:
Empty String
• Generate N-Bit Binary Strings:
Input:
2
Expected Output:
00
01
10
11
• Implement Set Operations:
Input:
4
1234
3
345
Expected Output:
12345
34
12
125
• Is List Sorted Checker:
Input:
5
12345
Expected Output:
True
• Duplicate Element Checker:
def has_duplicates(lst):
Duplicates found!
return len(lst) != len(set(lst))
numbers = [1, 2, 3, 4, 5, 2]
if has_duplicates(numbers):
print("Duplicates found!")
else:
print("No duplicates.")
• Capitalize First Letter of Words:
text = input("Enter a sentence: ") Enter a sentence: hello world
capitalized_text = text.title() from python
Capitalized: Hello World From
print("Capitalized:",capitalized_te Python
xt)
• Remove Duplicates from List:
Input:
6
135371
Expected Output:
1357
• Add Commas Between Characters:
Input:
Apple
Expected Output:
A,p,p,l,e