CBSE Class 11 Computer Science Question 19 of 19

Strings in Python — Question 19

Back to all questions
19
Question

Question 18

Write a program to remove 'i' (if any) from a string.

Solution
input_string = input("Enter a string: ")
result_string = input_string.replace('i', '')
print("String after removing 'i':", result_string)
Output
Enter a string: institute
String after removing 'i': nsttute
Answer

input_string
=
input
(
"Enter a string: "
)
result_string
=
input_string
.
replace
(
'i'
,
''
)
print
(
"String after removing 'i':"
,
result_string
)
Output
Enter a string: institute
String after removing 'i': nsttute