KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Write a Python program to check the index of a particular character.

Python String Manipulation

2 Likes

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

3 Likes


Related Questions