1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Setler79 [48]
3 years ago
10

Write a program that prompts users for the name and number of points of two basketball teams in main. Create one function to det

ermine the possible scenarios and return the result. The function uses a nested if to calculate the winner (if any) or if both teams tied (have the same number of points).
Computers and Technology
1 answer:
Ivan3 years ago
8 0

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)

<u>Output</u>:

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:

<u>Following are the description of the program</u>.

  • 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.
You might be interested in
An online survey is an effective way for an administrative professional to gather information. True False
Strike441 [17]

Answer:

True is the correct answer for the above question.

Explanation:

  • An online survey is done with the help of social sites that connects many people in conversation from all over the world. So to do an effective survey, it is best to choose the online medium.
  • The administrative professional is a professional, who works to do administrative tasks like managing the organization.
  • The above question-statement says that the online survey is the best survey, which is the correct statement, which is described above. Hence the answer is true for the above question.
7 0
3 years ago
Write a program that reads in two integers typed on the keyboard and outputs their sum, difference, and product.
dsp73
# Written in python

a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))

sum = a + b

# subtract the smaller number from the bigger
if a < b:
    dif = a - b
else:
    dif = b - a

prod = a * b

print("The sum is", sum)
print("The dif is", dif)
print("The product is", prod)
6 0
4 years ago
Comments can be hidden by clicking the _____ button.
Tamiku [17]
C because previous sends you back to something before such as a web page, Next does the opposite and I can't remember what Show MarkUp does.

5 0
4 years ago
Write down the functions of network layer in your own words.ASAP
sergeinik [125]
Hrhnebevevebnenebebenene
8 0
3 years ago
You are most likely to automatically encode information about
Orlov [11]

Answer:

You are most likely to automatically encode information about the sequence of your day's events.

5 0
3 years ago
Other questions:
  • 10 points (sorry it won’t let me do more points)
    10·1 answer
  • Which one of these do not belong on the Do's list in Helpful Hints when preparing a presentation: Which one of these do not belo
    8·1 answer
  • Which type of approach grew out of the development of computers, where even complex behavior such as learning, remembering, cate
    5·1 answer
  • Multiple Choice
    9·1 answer
  • What should be used to screw on broadheads? needle-nose pliers gloves thumb and forefinger only specially designed wrench
    6·1 answer
  • Which type of element is , and what is the meaning of that element?
    8·1 answer
  • Was just testing how this works, no actual question; feel free to take the points anyways though. ​
    13·1 answer
  • Explain the Decision making statement​
    15·1 answer
  • GOOD EVENING, FRIENDS, I WANT TO ASK ON THE ACCOUNT OF HIS NAME‏BENJEMIN360 . THIS ANSWERS ARE VERY WONDERFUL, BUT I CAN'T COMMU
    6·1 answer
  • imagine that you are explaining the art of visual comparison to a group of photography students. You are mentoring. What do you
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!