Advertisement
aneliabogeva

Fishing

Jun 6th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. daily_number = int(input())
  2. name_of_fish = input()
  3. counter = 0
  4. price = 0
  5. final_price = 0
  6.  
  7. while name_of_fish != "Stop":
  8. kilograms = float(input())
  9. price = 0
  10. for i in range(0, len(name_of_fish)):
  11. sum = name_of_fish[i]
  12. price += ord(sum)
  13. total_price = price / kilograms
  14. counter += 1
  15. if counter % 3 != 0:
  16. final_price -= total_price
  17. else:
  18. final_price += total_price
  19. if counter == daily_number:
  20. print("Lyubo fulfilled the quota!")
  21. break
  22. else:
  23. name_of_fish = input()
  24. if final_price > 0:
  25. print(f"Lyubo's profit from {counter} fishes is {final_price:.2f} leva.")
  26. else:
  27. print(f"Lyubo lost {abs(final_price):.2f} leva today.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement