0
where is the problem in this code?
i know there is problem in line 8 but i don't know why please help me str = input("type the whole text you want to be searched:") count = 0 y = input("what letter are you willing to be counted?:") for x in str: if x==y: count += 1 print ("there is " + count + y + "in your text")
3 Réponses
+ 2
str = input("type the whole text you want to be searched:")
count = 0
y = input("what letter are you willing to be counted?:")
for x in str:
if x==y:
count += 1
print ("there is " , count , y + "in your text")
0
Use this because you can't concatenate strings and integer
0
Hi EMOJIMAN!
But if you want to use "+" symbol as concat operator, you can concatenate integer with string using the str() function, which converts a number to a string.
print ("there is " + str(count) + y + " in your text")