Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Counting people by age.
- child = 0
- early = 0
- prime = 0
- mature = 0
- elderly = 0
- tries = 0
- print("Counting people by age.")
- print("Child = 0-14 early = 15-24 prime = 25-54 mature = 55-65 elderly = 66 and over")
- print("Enter age for 10 people.")
- keep_running = False
- while (keep_running == False) and (tries < 10):
- tries = tries + 1
- age = int(input ("Enter age in years, person " + str(tries) + " > "))
- if age > 0 and age <= 14:
- child = child + 1
- elif age > 14 and age <= 24:
- early = early +1
- elif age > 24 and age <= 54:
- prime = prime + 1
- elif age > 54 and age <= 65:
- mature = mature + 1
- elif age > 65:
- elderly = elderly + 1
- else:
- print("I do not understand. Please run again")
- else:
- print("child = " + str(child) + " early = " + str(early) + " prime = " + str(prime) + " mature = " + str(mature) + " eldery = " + str(elderly))
Advertisement
Add Comment
Please, Sign In to add comment