Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
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

Knowledge Booster
Background pattern image
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
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education