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
stiks02 [169]
4 years ago
7

Write a program that asks for the names of three runners and the time, in minutes (no seconds, etc.), it took each of them to fi

nish a race. The program should display the names of the runners in the order that they finished. Note, assume there are no ties.

Computers and Technology
1 answer:
Crank4 years ago
5 0

Answer:

Complete python code with explanation and output results is given below

Explanation:

User is asked to input names of runners and their finishing time

We have to determine first, second and third according to their finishing time.

if else conditioning is used to determine who has lowest finishing time.

Outer if is used to decide first position and inner if is used to decide second and third position.

str() function is used to concatenate the integer variable with string

Code:

runner1 = input("Please enter name of the runner1 ")

time1 = int(input("Please enter the time of runner1 "))

runner2 = input("Please enter name of the runner2 ")

time2 =int(input("Please Enter name of the runner2 "))

runner3 = input("Please enter name of the runner3 ")

time3 =int(input("Please Enter name of the runner3 "))

if(time1 < time2 and time1 < time3):  

   if(time2 < time3): // to decide 2nd and 3rd position

       print(runner1+" has finished First with time: "+str(time1))

       print(runner2+" has finished Second with time: "+str(time2))

       print(runner3+" has finished Third with time: "+str(time3))

   else:

       print(runner1+" has finished First with time: "+str(time1))

       print(runner3+" has finished Second with time: "+str(time3))

       print(runner2+" has finished Third with time: "+str(time2))

if(time2 < time1 and time2 < time3):  

   if(time1 < time3):

       print(runner2+" has finished First with time: "+str(time2))

       print(runner1+" has finished Second with time: "+str(time1))

       print(runner3+" has finished Third with time: "+str(time3))

   else:

       print(runner2+" has finished First with time: "+str(time2))

       print(runner3+" has finished Second with time: "+str(time3))

       print(runner1+" has finished Third with time: "+str(time1))

if(time3 < time1 and time3 < time2):

   if(time2 < time1):    

       print(runner3+" has finished First with time: "+str(time3))

       print(runner2+" has finished Second with time: "+str(time2))

       print(runner1+" has finished Third with time: "+str(time1))

   else:

       print(runner3+" has finished First with time: "+str(time3))

       print(runner1+" has finished Second with time: "+str(time1))

       print(runner2+" has finished Third with time: "+str(time2))

Output:

Program has been tested with multiple inputs and results are accurate as per problem specifications.

Please enter name of the runner1 danny

Please enter the time of runner1  45

Please enter name of the runner2  sam

Please enter the time of runner2  34

Please Enter name of the runner3  tedd

Please enter the time of runner3  23

tedd has finished First with time: 23

sam has finished Second with time: 34

danny has finished Third with time: 45

You might be interested in
Complete the sentence.
KatRina [158]

Answer:

tCP

Explanation:

6 0
3 years ago
1. Which of the following is a result of a successful negotiation?
Alik [6]
Maybe a Win win outcome
7 0
4 years ago
Read 2 more answers
Although the chi-square distribution is continuous, it is used to analyze discrete (counts) data
Roman55 [17]
This is true! The chi-square distribution is continuous and it is used to analyze discrete (counts) data.
4 0
4 years ago
Mobile devices need to work within limited screen space ? true or false
wariber [46]
False. Trust me my friend
4 0
4 years ago
Read 2 more answers
Which role will grant a delegate read-only access to a particular workspace within a user’s Outlook mailbox?
DIA [1.3K]

Answer: i’m thinking it’s reviewer

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • A form of speech used by a speaker who is attempting to be witty and amusing is _________.
    13·2 answers
  • Why did the Wright brothers construct their own wind tunnel?
    11·1 answer
  • A tripod head can move vertically or horizontally. What term describes these movements?
    15·2 answers
  • What is the full form of PDP​
    7·1 answer
  • Example 4-1: The styles for the main content of an HTML document main { clear: left; } main h1 { font-size: 170%; } main h2 { fo
    13·1 answer
  • Jenny has entered data about models of laptops from company A and company B in a worksheet. She enters model numbers of laptops
    10·1 answer
  • What can make an online interface difficult to use?​
    9·1 answer
  • Write C# program that will read name from keyboard and display it on screen. The program should throw an exception when the leng
    6·1 answer
  • Which type of vulnerability scan mimics the work of a threat actor who has already exploited a vulnerability and compromised cre
    5·1 answer
  • What is the difference between functional and non-functional testing
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!