-1
total = 0
fastest=9999
slowest=0
laps = input("How many laps?")
for i in range(laps):
    lap_time = input("Please enter laptime?")
    if lap_time > fastest:
        fastest = lap_time
    elif lap_time < slowest:
        slowest = lap_time
    total = total + lap_time
print("fastest =>",fastest)
print("slowest =>",slowest)
print("total =>",total)
print("average =>",total/laps)

I'm getting a type error for i in range(laps): TypeError: 'str' object cannot be interpreted as an integer

can someone help me i'm new

Thanks

1 Answers1

0

When you get a value from input it's interpreted as a string, a character value.

To use the value as an integer, do

laps = int(input("How many laps?"))
  • Thank you for helping me out it's working but i'm getting another error in line 7 if lap_time > fastest: TypeError: unorderable types: str() > int( – Firephantom19 May 20 '17 at 04:15