SimeonTs

SUPyF2 Basic Exercise More - 05. How Much Coffee Do You Need

Sep 24th, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.64 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1720#4
  4. Video: https://www.youtube.com/watch?time_continue=4&v=7sHE4HEUqi8
  5.  
  6. SUPyF2 Basic Exercise More - 05. How Much Coffee Do You Need?
  7.  
  8. Problem:
  9.  
  10. Everybody know that you passed to much time awake during night time...
  11. Your task here is to define how much coffee you need to stay awake after your night.
  12. Until you receive the command "END", you need to read a single command,
  13. according to this command you will print the number of coffee you need to stay awake during day time.
  14.  
  15. Note: If the count exceed 5 please return 'You need extra sleep'.
  16.  
  17. The list of events can contain the following:
  18. • You have homework to do ('coding').
  19. • You have a dog or a cat that just decide to wake up too early ('dog' or 'cat').
  20. • You just watch a movie ('movie').
  21. • Other events can be present and it will be represent by arbitrary string, just ignore this one.
  22.  
  23. Each event can be lowercase, or uppercase.
  24. If it is lowercase you need 1 coffee by events and if it is uppercase you need 2 coffees.
  25.  
  26. Input:
  27. dog
  28. CAT
  29. gaming
  30. END
  31. Output:
  32. 3
  33.  
  34. Input:
  35. movie
  36. CODING
  37. MOVIE
  38. CLEANING
  39. cat
  40. END
  41. Output:
  42. You need extra sleep
  43. """
  44. coffees = 0
  45. while True:
  46.     command = input()
  47.     if command == "END":
  48.         break
  49.     elif command == "coding" or command == "dog" or command == "cat" or command == "movie":
  50.         coffees += 1
  51.     elif command == "CODING" or command == "DOG" or command == "CAT" or command == "MOVIE":
  52.         coffees += 2
  53.  
  54. if coffees > 5:
  55.     print("You need extra sleep")
  56. else:
  57.     print(coffees)
Add Comment
Please, Sign In to add comment