7.5 PYTHON CODE
Use the function written in the last lesson to calculate the gold medalists’ average award money for all of their gold medals. Define another function in your program to calculate the average.

Your program should then output the average award money, including the decimal place. Your program should use a total of two functions. You may assume that the user will provide valid inputs.

Sample Run
Enter Gold Medals Won: 3
How many dollars were you sponsored in total?: 20000
Your prize money is: 245000
Your average award money per gold medal was 81666.6666667

Respuesta :

Answer:def Get_Winnings(m, s):

if not isinstance(m, str) or not isinstance(s, int):

return "Invalid"

try:

num_medals = int(m)

if num_medals < 1 or num_medals > 5:

return "Invalid"

prize_money = num_medals * 75000 + s

return prize_money

except ValueError:

return "Invalid"

def Calculate_Average(total_prize_money, num_medals):

return round(total_prize_money / num_medals, 10)

num_medals = input("Enter Gold Medals Won: ")

sponsored_amt = int(input("How many dollars were you sponsored in total?: "))

prize_money = Get_Winnings(num_medals, sponsored_amt)

if prize_money == "Invalid":

print("Your input is invalid.")

else:

print("Your prize money is: $" + str(prize_money))

avg_prize_money = Calculate_Average(prize_money, int(num_medals))

print("Your average award money per gold medal was " + str(avg_prize_money))

I'm extremely late but here it is!

Explanation:

I cant explain this