Thursday, January 16, 2014

Driver info

name = input("What is you driver name:") - a variable allowing you to type your desired name trackname = input("What is the name of the track:") -variable allowing you to type your desired track car = input("What is your car:")-variable allowing you to type your desired car tracklength = input("What is the length of the track:")-variable allowing you to type track length in print ("Driver name:",name)-this is printing driver name with the infomation from the variables above print ("Track:",trackname)-this is printing track name with the infomation from the variables above print ("Car:",car)-this is printing car model with the infomation from the variables above print ("Track length:",tracklength)-this is printing the trac length with the infomation from the variables above Laps = [] lapTime = 1- lap time has to be 1 or more while lapTime != 0: if number is not equal to zero repeat this function lapTime = float(input("Time around Lap:"))- this allows you to type in any number to your track time, even decimals thanks to the float(input section of code Laps.append(lapTime)- place the laps in a list Laps.pop(-1) - take the last lap off the trac record print(Laps)- diplay lap times fastestLap = Laps[0]- this gets all the lap times into a list for Lap in Laps: if Lap < fastestLap: fastestLaps = Lap print (fastestLap) - after it has cearched for the fastest lap it displays it to the pragrammer

No comments:

Post a Comment