A pedometer treats walking 1 step as walking 2.5 feet. Define a function named feet_to_steps that takes a float as a parameter, representing the number of feet walked, and returns an integer that represents the number of steps walked. Then, write a main program that reads the number of feet walked as an input, calls function feet_to_steps() with the input as an argument, and outputs the number of steps. Use floating-point arithmetic to perform the conversion.

Ex: If the input is:
150.5
the output is:
60

Respuesta :

fichoh

The program defines a function which converts the number of feets walked into steps and returns an integer value for the number of steps. The program is written below in python 3 :

def feet_to_steps(feet_walked):

#initialize a function called feet_to_steps

steps_walked = feet_walked / 2.5

#divides the number of feets by 2.5 and assign the number of steps to the variable steps_walked

return round(steps_walked)

#return the rounded integer value of steps_walked

feet = eval(input('Enter feets number of feets walked : '))

#prompts the user to input a float value for the number of feets

#A sample run of the program is given below and attached.

print(feet_to_steps(feet), ' steps')

Learn more :brainly.com/question/25097090

Ver imagen fichoh