Robotics & Artificial Intelligence
Write a Python program to check the index of a particular character.
Python String Manipulation
1 Like
Answer
string = input("Enter a string: ")
ch = input("Enter a character to find its index: ")
val = string.find(ch)
print("The index of the character is:", val)Output
Enter a string: Python
Enter a character to find its index: t
The index of the character is: 2
Answered By
1 Like
Related Questions
Write a Python program to convert all the letters of a string in uppercase.
Write a Python program to perform the following tasks.
a. "Hello, my friends, I am Jeck"
b. Replace Jeck with Tiya
Write a Python program to create a sub string from a string.
Write a Python program to demonstrate the use of the join function.