Respuesta :
Answer:
Following are the program in the Python Programming Language.
#define function
def winner(t1,t2,name1,name2):
#check the score of 1st team is greater
if(t1>t2):
print("{} is the winner\n".format(name1))
#check the score of 2nd team is greater
elif(t1<t2):
print("{} is the winner\n".format(name2))
#check that both team have same score
else:
print("They are tie\n")
#declare variables to get input from the user
name1=input("Enter the name of 1st team: ")
t1=input("Enter the score of {}: ".format(name1))
name2=input("Enter the name of 2nd team: ")
t2=input("Enter the score of {}: ".format(name2))
#call the function and pass arguments
winner(t1, t2, name1, name2)
Output:
Enter the name of 1st team: Air Ballers
Enter the score of Air Ballers: 350
Enter the name of 2nd team: Ankle Breakers
Enter the score of Ankle Breakers: 450
Ankle Breakers is the winner
Explanation:
Following are the description of the program.
- Firstly, define function 'winner()' and pass four arguments in the parameters which are 't1', 't2', 'name1', and 'name2', inside the function, set the if-else conditional statement to check that which team gets the higher score or they are tied.
- Set four variables in which we get scores or names of the team from the user which are 't1', 't2', 'name1', and 'name2'.
- Finally, we call the following function that is 'winner()' and pass the arguments.