simeonshopov

Fishing

Oct 23rd, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. quote = int(input())
  2. pay = 0
  3. get = 0
  4. fish_count = 0
  5.  
  6. for fish in range(1, quote + 1):
  7.   fish_name = input()
  8.   if fish_name == "Stop":
  9.     break
  10.   else:
  11.     fish_weight = float(input())
  12.     fish_price = 0
  13.     fish_count += 1
  14.     for char in fish_name:
  15.       char = ord(char)
  16.       fish_price += char
  17.     fish_price /= fish_weight
  18.     if fish_count % 3 != 0:
  19.       pay += fish_price
  20.     else:
  21.       get += fish_price
  22.  
  23. if fish_count == quote:
  24.   print(f"Lyubo fulfilled the quota!")
  25. if pay > get:
  26.   print(f"Lyubo lost {(pay - get):.2f} leva today.")
  27. else:
  28.   print(f"Lyubo's profit from {fish_count} fishes is {(get - pay):.2f} leva.")
Advertisement
Add Comment
Please, Sign In to add comment