Advertisement
BbJLeB

08. Fishing

Jun 4th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. # 08. Fishing
  2.  
  3. limit = int(input())
  4.  
  5. money_won = 0
  6. money_lost = 0
  7.  
  8. fishes_counter = 0
  9.  
  10. for i in range(1,limit+1):
  11.     name = input()
  12.     if name == "Stop":
  13.         break
  14.     fishes_counter += 1
  15.     weight = float(input())
  16.  
  17.     current_price = 0
  18.     for letter in name:
  19.         current_price += ord(letter)
  20.  
  21.     current_price /= weight
  22.     if i % 3 == 0:
  23.         money_won += current_price
  24.     else:
  25.         money_lost += current_price
  26.  
  27. if fishes_counter == limit:
  28.     print(f"Lyubo fulfilled the quota!")
  29. money_left = money_won - money_lost
  30.  
  31. if money_left <0:
  32.     print(f"Lyubo lost {abs(money_left):.2f} leva today.")
  33. else:
  34.     print(f"Lyubo's profit from {fishes_counter} fishes is {money_left:.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement