desislava_topuzakova

05. Movie Stars

Mar 20th, 2021
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. budget = float(input())
  2. # command -> име на актьор или ACTION
  3. command = input()
  4. # stop -> command == 'ACTION'
  5. # continue -> command != 'ACTION'
  6.  
  7. while command != 'ACTION':
  8.     # име на актьор
  9.     actor_name = command
  10.     salary = 0
  11.     # > 15 -> заплата = 20% от бюджет
  12.     # <= 15 -> заплата = вход
  13.     if len(actor_name) > 15:
  14.         salary = 0.2 * budget
  15.     else:
  16.         salary = float(input())
  17.  
  18.     budget -= salary
  19.     if budget <= 0:
  20.         break
  21.     command = input()
  22.  
  23. # бюджетът е стигнал
  24. if budget >= 0:
  25.     print(f'We are left with {budget:.2f} leva.')
  26. else:
  27.     # -50 -> 50
  28.     print(f'We need {abs(budget):.2f} leva for our actors.')
Advertisement
Add Comment
Please, Sign In to add comment