#Program to perform tasks similar to the string method: count() and find():
x=input("Enter the string:")
y=input("Enter the character you want to find:")
z=len(x)
k=0
for i in range(0,z):
if x[i]==y:
k=k+1
if k==1:
z=i
print("The total no. of occurance is:",k)
print("The first occureuce position is in:",z+1)
x=input("Enter the string:")
y=input("Enter the character you want to find:")
z=len(x)
k=0
for i in range(0,z):
if x[i]==y:
k=k+1
if k==1:
z=i
print("The total no. of occurance is:",k)
print("The first occureuce position is in:",z+1)
Comments
Post a Comment