To find the fastest race among the entire race, enter the race time in seconds and make a list to store them. After that create a loop that will continue till the last race is not completed. Now, compare the race times . In main function, enter the race time or enter no more races. Finally, print the fastest race value. The easiest code in python language is written below in MaxRace.py file.
Further explanation:
Code: MaxRace.py
raceTime=Input(“Enter the race time or enter ‘no more races’:”)
if raceTime!=”no more races”:
fastest_race_time=float(raceTime)
# compare the race times
while raceTime!=’no more races’:
compareTime=float(raceTime)
if fastest_race_time>compareTime:
fastest_race_time=compareTime
raceTime=input(“Enter the race time or enter ‘no more races’: “)
#print the fastest race
print(fastest_race_time)
else:
print(raceTime)
Output:
Run the commands in python, the output will be looking as below:
Enter the race time or enter ‘no more races’: 49.0
Enter the race time or enter ‘no more races’: 52.0
Enter the race time or enter ‘no more races’: 39.0
Enter the race time or enter ‘no more races’: 23.6
52.0
Learn more:
1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011
2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832
Answer details:
Grade: College Engineering
Subject: Computer Science and Engineering
Chapter: Python Programming
Keyword:
Python, input, output, programming, statements, loops, if-else, print, while, body, main body, char, int, float, variables, race, time, maximum, compare, code, fastest, seconds