Spocoman

02. Bonus Score

Dec 16th, 2021 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. n = int(input())
  2. bonus = 0
  3.  
  4. if n < 101:
  5.     bonus = 5
  6. elif n < 1001:
  7.     bonus = n * 0.2
  8. else:
  9.     bonus = n * 0.1
  10.  
  11. if n % 2 == 0:
  12.     bonus += 1
  13. elif n % 5 == 0:
  14.     bonus += 2
  15.  
  16. print(bonus)
  17. print(n + bonus)
  18.  
  19. РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
  20.  
  21. n = int(input())
  22.  
  23. bonus = (5 if n < 101 else n * (0.2 if n < 1001 else 0.1)) + (1 if n % 2 == 0 else 2 if n % 5 == 0 else 0)
  24.  
  25. print(f'{bonus}\n{bonus + n}')
  26.  
Add Comment
Please, Sign In to add comment