create a Python program that: Opens a file and reads the contents of the following file trips.txtDownload trips.txt The file contains several lines of data, with each data item separated by commas.  The data is: A trip date The amount of fuel used on the trip The number of miles traveled on the trip For each of the lines of data in the file, separate the data items and put them in appropriate variables The file contents are in the form of strings, so you must convert the numbers in the data into the proper type Create a function that calculates the fuel mileage achieved on each trip Pass the appropriate data to this function Place this function in a separate module Call the function as needed and have the function return the calculated fuel mileage Create a function that displays the following items on a single line, and place the function in the same module as the previous function. Pass the appropriate data to this function Trip data Amount of fuel used Numbers of miles traveled Fuel mileage calculated for the trip Call the function as needed to display the data items Create a new file to save the data read and the fuel mileage calculated for the trip Write the data on separate lines for each trip in the data, with each item separated by commas Remember that all of the data must be saved in the string form The program should: Use variables with meaningful names Name the module containing the functions "SupportMod.py" Import the module into your program Display easily understood prompts when collecting user input Prompt the user for the name of the file to read the data from, and the name of the file to store the revised data Have appropriate comments indicating what each part of the program is doing Have a comment area at the beginning of the program identifying the author of the program and the class it was created for

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
create a Python program that:
  • Opens a file and reads the contents of the following file
    • trips.txtDownload trips.txt
      • The file contains several lines of data, with each data item separated by commas.  The data is:
        • A trip date
        • The amount of fuel used on the trip
        • The number of miles traveled on the trip
      • For each of the lines of data in the file, separate the data items and put them in appropriate variables
        • The file contents are in the form of strings, so you must convert the numbers in the data into the proper type
  • Create a function that calculates the fuel mileage achieved on each trip
    • Pass the appropriate data to this function
    • Place this function in a separate module
    • Call the function as needed and have the function return the calculated fuel mileage
  • Create a function that displays the following items on a single line, and place the function in the same module as the previous function.
    • Pass the appropriate data to this function
      • Trip data
      • Amount of fuel used
      • Numbers of miles traveled
      • Fuel mileage calculated for the trip
    • Call the function as needed to display the data items
  • Create a new file to save the data read and the fuel mileage calculated for the trip
    • Write the data on separate lines for each trip in the data, with each item separated by commas
    • Remember that all of the data must be saved in the string form
The program should:
  • Use variables with meaningful names
  • Name the module containing the functions "SupportMod.py"
  • Import the module into your program
  • Display easily understood prompts when collecting user input
  • Prompt the user for the name of the file to read the data from, and the name of the file to store the revised data
  • Have appropriate comments indicating what each part of the program is doing
  • Have a comment area at the beginning of the program identifying the author of the program and the class it was created for
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
File Input and Output 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