Oct-10-2021, 06:40 PM
hello just starded to following studies in python but there are short(4h once in 2 weeks) and dont explain everything what we get in in our homework
so i have a question on how to find a specific number in a loop and print it how many time it was in that loop i did tried with .count() but i do get an error that its not possible with int AttributeError: 'int' object has no attribute 'count'
i did try and other options but really cant find this one
and im already sitting for few hours on this one
Each of the following n lines contains one integer.
Count and print the number of 0
like
so i have a question on how to find a specific number in a loop and print it how many time it was in that loop i did tried with .count() but i do get an error that its not possible with int AttributeError: 'int' object has no attribute 'count'
i did try and other options but really cant find this one
and im already sitting for few hours on this one
for x in range(1,5): num=int(input('number: ')) print(num.count(0))my home work is to find 0 where user put in numbers
Each of the following n lines contains one integer.
Count and print the number of 0
like
Output:#input
10
0
30
20
0
30
50
#output
'number of 0's is 2'
all the help is appreciated