Advertisement
Spocoman

Bonus Score

Jan 6th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. number = int(input())
  2. bonus = 0.0
  3.  
  4. if number <= 100:
  5.     bonus = 5
  6. elif number > 1000:
  7.     bonus = number * 0.1
  8. else:
  9.     bonus = number * 0.2
  10.  
  11. if number % 2 == 0:
  12.     bonus += 1
  13. elif number % 10 == 5:
  14.     bonus += 2
  15.  
  16. print(bonus)
  17. print(number + bonus)
  18.  
  19.  
  20.  
  21. Тарикатско решение:
  22.  
  23. number = int(input())
  24. bonus = {number <= 100: 5, 100 < number <= 1000: number * 0.2, number > 1000: number * 0.1}[True]
  25. bonus += 1 if number % 2 == 0 else 0
  26. bonus += 2 if number % 10 == 5 else 0
  27. print(f'{bonus}\n{number + bonus}')
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement