KnowledgeBoat Logo
|

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