SansPapyrus683

Python Exercises

Dec 8th, 2021 (edited)
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. # Part 1: Are you rich?
  2. money = 2000
  3. if money > 1000:
  4.     print("I'm rich!")  # This is the segment that runs.
  5. else:
  6.     print("I'm not rich!!")
  7.     print("But I might be later...")
  8.  
  9. # Part 2: Twinkies!
  10. twinkies = 300
  11. if twinkies < 100 or twinkies > 500:
  12.     print("Too few or too many")
  13.  
  14. # Part 3: Just the right number
  15. money = 4200
  16. if (100 <= money and money <= 500) or (1000 <= money and money <= 500):
  17.     print("nice")
  18.  
  19. # Part 4: I can fight those ninjas
  20. ninjas = 5
  21. if ninjas < 10:
  22.     print("I can fight those ninjas")
  23. elif ninjas < 30:
  24.     print("It’ll be a struggle, but I can take ’em.")
  25. elif ninjas < 50:
  26.     print("That’s too many!")
  27.  
Add Comment
Please, Sign In to add comment