Hello. I am having a bit of trouble with this code. Its about making a running log using O(n) (linear) notation but I keep having problems figuring it out. I would appreciate the help for figuring out this code. Thanks. This is the problem: Write a program that: Asks the user for number of runs For each run, ask the user What the distance was in miles (in decimal format, e.g. 3.1 miles is acceptable) What the time was in minutes (in decimal format, e.g. 23.9 minutes is acceptable) Output the average pace (in minutes per mile) of all runs. Please paste the code down below. Thanks.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hello. I am having a bit of trouble with this code. Its about making a running log using O(n) (linear) notation but I keep having problems figuring it out. I would appreciate the help for figuring out this code. Thanks.

This is the problem:

Write a program that:

  1. Asks the user for number of runs
  2. For each run, ask the user
    1. What the distance was in miles (in decimal format, e.g. 3.1 miles is acceptable)
    2. What the time was in minutes (in decimal format, e.g. 23.9 minutes is acceptable)
  3. Output the average pace (in minutes per mile) of all runs.

Please paste the code down below. Thanks.

Expert Solution
Step 1: Algorithm:

Step-1: Start
Step-2: Declare variable num_runs and take input from the user
Step-3: Declare variable total_distance, total_time and assign value 0
Step-4: Start loop for i in range(num_runs)
    Step-4.1: Declare variable distance and take input from the user 
    Step-4.2: Declare variable time and take input from the user
    Step-4.3: In total_distance assign total_distance + distance
    Step-4.4: In total_time assign total_time + time
Step-5: Declare variable average_pace and assign total_time / total_distance
Step-6: Print average_pace
Step-7: Stop

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education