Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Anyone Airlines is having a sale on flights leaving from Tampa. Write a program that uses a while loop to store to a file
Anyone Airlines is having a sale on flights leaving from Tampa. Write a program that uses a while loop to store to a file the names of destinations, regular prices, and price reductions (as percents) for selected flights in the promotion. The program should enable the user to enter this data from the keyboard as shown below. Integers should be used for all numerical input. Each datum should be stored on its own line in the file. The while loop should repeat until the user presses Enter (Return on a Mac) for the name. Then, the file should be closed and a message should be displayed. See Example Output. Example Output Enter destination name or Enter to quit San Francisco Enter flight's regular price 550 Enter reduction percent for sale 10 Enter destination name or Enter to quit New Orleans Enter flight's regular price 330 Enter reduction percent for sale 10 Enter destination name or Enter to quit Atlanta Enter flight's regular price 295 Enter reduction percent for sale 20 Enter destination name or Enter to quit File was created program6_2.py This program reads the text file created in the program above. Use f-strings along with any necessary calculations to create a table with a row with the indicated columns for each destination as shown below. $ signs are not required but use float with 2 decimal positions for numerical output. Choose your own column widths but include column headings as shown. Example Output DESTINATION San Francisco New Orleans Atlanta REG.PRICE REDUCED SALE PRICE 550.00 55.00 495.00 330.00 33.00 297.00 295.00 59.00 236.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started