SHARE
TWEET

n/a

a guest Sep 11th, 2019 97 in 328 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. age = int(input())
  2. price = float(input())
  3. toy_p = int(input())
  4.  
  5. money = 0
  6. toy_count = 0
  7. counter = 1
  8. odd_counter = 1
  9. sequence = 0
  10. years = 0
  11.  
  12. for i in range(1,age + 1):
  13.     if counter % 2 == 0:
  14.         sequence = 10 + (odd_counter - 1)*10
  15.         odd_counter += 1
  16.         money += sequence
  17.         years += 1
  18.  
  19.     else :
  20.         toy_count += 1
  21.     counter += 1
  22.  
  23. if ((money-years) + (toy_count * toy_p)) > price :
  24.     print(f'Yes! {((money-years)+(toy_count*toy_p))- price:.2f}')
  25. else :
  26.     print(f'No! {price - ((money-years)+(toy_count*toy_p)):.2f}')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top