contestada

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.

Respuesta :

fichoh

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

def feet_to_steps(feet):

#initialize a function called feet_to_steps

num_steps = feet / 2.5

#divide the number of feets by 2.5 and assign the number of steps to the variable num_steps

return round(num_steps)

#return the rounded integer value of num_steps

your_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(your_feet), ' steps')

Learn more :https://brainly.com/question/25097090

Ver imagen fichoh