Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. meal = int(input("How long since your last meal? "))
  2. season = input("What season is it? ")
  3.  
  4. if meal//60>6 and (season == "summer" or "spring"):
  5. print("You must be hungry")
  6. elif meal//60>4 and (season == "winter" or "autumn"):
  7. print("You must be hungry")
  8. else:
  9. print("OK")
  10.  
  11. ~~~~~~~~~~~~~~~~~
  12.  
  13.  
  14. Write a program which asks the user how long it been since their last meal (in minutes) and the current season (summer, winter, autumn, spring).
  15.  
  16. If it has been more than 6 hours since their last meal, your program should output You must be hungry, unless the season is either winter or autumn, in which case, the program should output You must be hungry if it has been more than 4 hours since their last meal. In all other cases, the program should print OK.
  17.  
  18. You can assume all inputs will be valid.
  19.  
  20. Example:
  21.  
  22. How long since your last meal? 140
  23. What season is it? summer
  24. OK
  25. Example:
  26.  
  27. How long since your last meal? 360
  28. What season is it? summer
  29. OK
  30. Example:
  31.  
  32. How long since your last meal? 399
  33. What season is it? summer
  34. You must be hungry
  35. Example:
  36.  
  37. How long since your last meal? 300
  38. What season is it? winter
  39. You must be hungry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement