Python Forum
Homework( Solution found)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Homework( Solution found)
#3
It would me much easier if you left the input numbers as strings instead of changing them to intergers.
# This version asks for the 7 numbers first then counts the amount 0's after
nums = '' 
for x in range(7):
    num = input('number: ')
    nums = nums + num
 
zeros = nums.count('0')
print(f"number of 0's is {zeros}")
Reply


Messages In This Thread
Homework( Solution found) - by Zaochen - Oct-10-2021, 06:40 PM
RE: Homework( Solution found) - by Daring_T - Dec-23-2021, 01:54 AM
RE: Homework( Solution found) - by BashBedlam - Dec-23-2021, 04:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 5 3,900 Nov-23-2020, 05:15 PM
Last Post: cananb
  Need help with this homework for a course ASAP...need solution for completion. SP04123 8 5,227 Jun-21-2020, 06:15 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020