Advertisement
Spocoman

Christmas Gifts

Feb 27th, 2022 (edited)
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. command = input()
  2. adults = 0
  3. kids = 0
  4.  
  5. while command != "Christmas":
  6.     years = int(command)
  7.  
  8.     if years <= 16:
  9.         kids += 1
  10.     else:
  11.         adults += 1
  12.  
  13.     command = input()
  14.  
  15. kidsPrice = kids * 5
  16. adultsPrice = adults * 15
  17.  
  18. print(f"Number of adults: {adults}")
  19. print(f"Number of kids: {kids}")
  20. print(f"Money for toys: {kidsPrice}")
  21. print(f"Money for sweaters: {adultsPrice}")
  22.  
  23.  
  24. Леко тарикатската:)
  25.  
  26. adults = 0
  27. kids = 0
  28.  
  29. while True:
  30.     command = input()
  31.     if command == "Christmas":
  32.         break
  33.     if int(command) <= 16:
  34.         kids += 1
  35.     else:
  36.         adults += 1
  37.  
  38. print(f"Number of adults: {adults}")
  39. print(f"Number of kids: {kids}")
  40. print(f"Money for toys: {kids * 5}")
  41. print(f"Money for sweaters: {adults * 15}")
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement