Customized step counter   Learning Objectives In this lab, you will Create a function to match the specifications Use floating-point value division Instructions A pedometer treats walking 2,000 steps as walking 1 mile. It assumes that one step is a bit over 18 inches (1 mile = 36630 inches, so the pedometers assume that one step should be 18.315 inches). Let's customize this calculation to account for the size of our stride. Write a program whose input is the number of steps and the length of the step in inches, 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(f'{your_value:.2f}') Ex: If the input is: 5345 18.315 the output is: You walked 5345 steps which are about 2.67 miles. Your program must define and call the following function. The function should return the number of miles walked. def steps_to_miles(user_steps, step_length)         # Define your function here  if __name__ == '__main__':     # Type your code here

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Customized step counter

 

Learning Objectives

In this lab, you will

  • Create a function to match the specifications
  • Use floating-point value division

Instructions

A pedometer treats walking 2,000 steps as walking 1 mile. It assumes that one step is a bit over 18 inches (1 mile = 36630 inches, so the pedometers assume that one step should be 18.315 inches).

Let's customize this calculation to account for the size of our stride. Write a program whose input is the number of steps and the length of the step in inches, 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(f'{your_value:.2f}')

Ex: If the input is:

5345 18.315

the output is:

You walked 5345 steps which are about 2.67 miles.

Your program must define and call the following function. The function should return the number of miles walked.
def steps_to_miles(user_steps, step_length)

 

 

 

 

# Define your function here 

if __name__ == '__main__':
    # Type your code here.

main.py
Load default template...
1 # Define your function here
2
з if
# Type your code here.
name
main
':
4
Transcribed Image Text:main.py Load default template... 1 # Define your function here 2 з if # Type your code here. name main ': 4
Expert Solution
Step 1

here we are calculating the miles walked based on the number of steps given and the stretch of each step

miles   = user_steps * step_length / 36630

and for printing the float value , print(f'{your_value:.2f}') is used where .2 shows that afterdecimal 2 digits are there.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY