Hello,
I'm trying to change this script so that it calculates the speed of the slowest walker rather that the fastest walker. I know the change needs to happen in the while or if loop, but I don't know what exactly to change.
I'm still new to python and I'm not really sure where to start, any help would be appreciated. Thanks!
I'm trying to change this script so that it calculates the speed of the slowest walker rather that the fastest walker. I know the change needs to happen in the while or if loop, but I don't know what exactly to change.
I'm still new to python and I'm not really sure where to start, any help would be appreciated. Thanks!
Code:
num_walkers = float(input("How many walkers in your group? "))
dist = float(input("Enter the distance: "))
time = float(input("Enter the time: "))
speed = dist/time
i = 1
high_speed = speed
while i < num_walkers:
dist = float(input("Enter the distance: "))
time = float(input("Enter the time: "))
speed = dist/time
if speed > high_speed:
high_speed = speed
i = i + 1
print("The fastest speed in the walking group is: ",high_speed)
Comment