
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
Larz60+ write Oct-10-2021, 07:32 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.