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")

1st Sep 2021, 1:35 PM
Alireza Azizzadeh
Alireza Azizzadeh - avatar
3 Antworten
+ 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")
1st Sep 2021, 1:43 PM
Atul [Inactive]
0
Use this because you can't concatenate strings and integer
1st Sep 2021, 1:43 PM
Atul [Inactive]
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")
1st Sep 2021, 2:00 PM
Python Learner
Python Learner - avatar