DiYane

Black Flag

Aug 10th, 2023
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. def pirate_plunder(days, daily_plunder, expected_plunder):
  2.     total_plunder = 0
  3.  
  4.     for day in range(1, days + 1):
  5.         total_plunder += daily_plunder
  6.  
  7.         if day % 3 == 0:
  8.             total_plunder += 0.5 * daily_plunder
  9.  
  10.         if day % 5 == 0:
  11.             total_plunder *= 0.7
  12.  
  13.     if total_plunder >= expected_plunder:
  14.         print(f"Ahoy! {total_plunder:.2f} plunder gained.")
  15.     else:
  16.         percentage = (total_plunder / expected_plunder) * 100
  17.         print(f"Collected only {percentage:.2f}% of the plunder.")
  18.  
  19. days = int(input())
  20. daily_plunder = int(input())
  21. expected_plunder = float(input())
  22.  
  23. pirate_plunder(days, daily_plunder, expected_plunder)
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment