CYB 130 Week 4 Python LAB 5.20 Step Counter
CYB 130 Week 4 Python LAB 5.20 Step Counter
def steps_to_miles(user_steps):
return user_steps/2000
if __name__ == '__main__':
steps = float(input())
print('{:.2f}'.format(steps_to_miles(steps)))
Code 2
def steps_to_miles(user_steps): #function that convert steps into miles
miles = float(user_steps)/2000
return miles
if __name__ == '__main__':
steps = int(input()) #taking number of steps as user input
miles = steps_to_miles(steps) #calling steps_to_miles() for calculating miles
print('{:.2f}'.format(miles)) #printing miles
Code 3
def steps_to_miles(user_steps):
return user_steps / 2000
if __name__ == '__main__':
print('{:.2f}'.format(steps_to_miles(float(input()))))