{}
run-icon
main.py
import random def player_transfer_decision(): """ Prompts the user for player information and determines whether the player stays or leaves. """ # Get player information from the user league = input("""Enter the league: 1. Premier League 2. EFL Championship 3. EFL League One and Below\n: """) player_valuation = int(input("Enter the player's valuation in pounds:\n: ")) offer = int(input("Enter the offer received from the buying club in pounds:\n: ")) contract_amount = int(input("Enter the player's weekly contract amount in pounds:\n: ")) average_rating = float(input("Enter the player's average match rating:\n: ")) # Calculate "stay" factors stay_factors = (contract_amount / 1000) + (average_rating * 3) # Calculate "leave" factors based on league if league == "3": leave_factors = (offer - player_valuation) / 10000 elif league == "2": leave_factors = (offer - player_valuation) / 100000 elif league == "1": leave_factors = (offer - player_valuation) / 1000000 else: raise ValueError("Invalid league provided.") # Generate a random number total_factors = int(stay_factors) + int(leave_factors) random_number = random.randint(1, total_factors) # Determine the decision if random_number <= stay_factors: print("The player stays.") else: print("The player leaves.") # Run the function player_transfer_decision()
Output