Python program to search a character within a string?
n="computer" ch=input("Enter character to search ") z=0 for i in n: if(i==ch): z=1 break if(z==1): print("character is present") else: print("character is not present")
Output:
Enter character to search k
character is not present
>>>
Enter character to search m
character is present
>>>