215k views
2 votes
g A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value))

User Jamali
by
4.8k points

2 Answers

4 votes

Answer:

steps = int(input("Enter the number of steps: "))

miles = steps / 2000

print('{:.2f}'.format(miles))Explanation:

User Pierson
by
4.6k points
3 votes

Answer:

# Program is written in Python Programming Language

# Comments are used for explanatory purpose

# Program starts here

# Accept input

Steps = input (Number of Steps: ")

# Calculate distance

distance = float(2000) * float(steps)

#Print Formatted Result

print('%0.2f' % distance)

# End of Program

.--------

The above program converts number of steps to miles.

At line 5, the number of steps is inputted and stored in variable named Steps.

At line 6, the number of miles is calculated by multiplying 2000 by the content of variable Steps

The result is printed at line 8

User Brian Hamill
by
5.7k points