Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 7, Problem 5TF
A file object's writelines method automatically writes a newline (‘\n‘) after writing each list item to the file.
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule02:18
Students have asked these similar questions
Program Specification
For this assignment you will write a program to help people record the events of their day by supplying prompts and then saving their responses along with the question and the date to a file.
Functional Requirements
This program must contain the following features:
Write a new entry - Show the user a random prompt (from a list that you create), and save their response, the prompt, and the date as an Entry.
Display the journal - Iterate through all entries in the journal and display them to the screen.
Save the journal to a file - Prompt the user for a filename and then save the current journal (the complete list of entries) to that file location.
Load the journal from a file - Prompt the user for a filename and then load the journal (a complete list of entries) from that file. This should replace any entries currently stored the journal.
Provide a menu that allows the user choose these options
Your list of prompts must contain at least five different prompts.…
Problem
Charge Account Validation
Create an application that reads the contents of the file into an array or a List . The application should then let the user enter a charge account number. The program should determine whether the number is valid by searching for it in the array or List that contains the valid charge account numbers. If the number is in the array or List , the program should display a message indicating the number is valid. If the number is not in the array or List , the program should display a message indicating the number is invalid.
For Visual Studio .Net 4.6.1
current solution on bartleby does not work as it does not actually use a list and does not properly retrieve the file
file is a text document with 18 7 digit numbers named ChargeAccounts.txt
Laboratory Exercise No. 40 Filename: Lab_exer40 You are tasked to create a program that will get the basic salary of 5 employees from the user and these 5 values should be saved in a list named as basicSalary. The user will then enter the incentive rate (Example. 0.15) The program should compute the net salary. The net salary is computed using the formula basic salary multiplied by incentive rate. Store the computed net salary in another list which will be named as net_salary. Display the values stored in the 2 lists. Example Output: Enter basic salary : 200 Enter basic salary : 300 Enter basic salary : 450 Enter basic salary : 600 Enter basic salary : 750 Enter incentive rate : 0.50 Basic salary [200,300,450,600,750] Net Salary [100,150,225,300,375]
Chapter 7 Solutions
Starting Out with Python (4th Edition)
Ch. 7.2 - What will the following code display? numbers =...Ch. 7.2 - Prob. 2CPCh. 7.2 - Prob. 3CPCh. 7.2 - Prob. 4CPCh. 7.2 - Prob. 5CPCh. 7.2 - Prob. 6CPCh. 7.2 - Prob. 7CPCh. 7.2 - Prob. 8CPCh. 7.3 - Prob. 9CPCh. 7.3 - Prob. 10CP
Ch. 7.3 - Prob. 11CPCh. 7.3 - Prob. 12CPCh. 7.3 - Prob. 13CPCh. 7.4 - What will the following code display? names =...Ch. 7.5 - Prob. 15CPCh. 7.5 - Prob. 16CPCh. 7.5 - Prob. 17CPCh. 7.5 - Prob. 18CPCh. 7.8 - Prob. 19CPCh. 7.8 - Prob. 20CPCh. 7.8 - Write a set of nested loops that display the...Ch. 7.9 - Prob. 22CPCh. 7.9 - Prob. 23CPCh. 7.9 - Prob. 24CPCh. 7.9 - Prob. 25CPCh. 7.10 - Prob. 26CPCh. 7.10 - Prob. 27CPCh. 7.10 - Prob. 28CPCh. 7.10 - Prob. 29CPCh. 7.10 - Prob. 30CPCh. 7.10 - To create a bar chart with the bar function, what...Ch. 7.10 - Assume the following statement calls the bar...Ch. 7.10 - Prob. 33CPCh. 7 - This term refers to an individual item in a list....Ch. 7 - This is a number that identifies an item in a...Ch. 7 - Prob. 3MCCh. 7 - This is the last index in a list. a. 1 b. 99 c. 0...Ch. 7 - This will happen if you try to use an index that...Ch. 7 - This function returns the length of a list. a....Ch. 7 - When the operator's left operand is a list and...Ch. 7 - This list method adds an item to the end of an...Ch. 7 - This removes an item at a specific index in a...Ch. 7 - Prob. 10MCCh. 7 - If you call the index method to locate an item in...Ch. 7 - Prob. 12MCCh. 7 - This file object method returns a list containing...Ch. 7 - Which of the following statement creates a tuple?...Ch. 7 - Prob. 1TFCh. 7 - Prob. 2TFCh. 7 - Prob. 3TFCh. 7 - Prob. 4TFCh. 7 - A file object's writelines method automatically...Ch. 7 - You can use the + operator to concatenate two...Ch. 7 - Prob. 7TFCh. 7 - You can remove an element from a tuple by calling...Ch. 7 - Prob. 1SACh. 7 - Prob. 2SACh. 7 - What will the following code display? values = [2,...Ch. 7 - Prob. 4SACh. 7 - Prob. 5SACh. 7 - Prob. 6SACh. 7 - Prob. 1AWCh. 7 - Prob. 2AWCh. 7 - Prob. 3AWCh. 7 - Prob. 4AWCh. 7 - Write a function that accepts a list as an...Ch. 7 - Prob. 6AWCh. 7 - Prob. 7AWCh. 7 - Prob. 8AWCh. 7 - Total Sales Design a program that asks the user to...Ch. 7 - Prob. 2PECh. 7 - Rainfall Statistics Design a program that lets the...Ch. 7 - Prob. 4PECh. 7 - Prob. 5PECh. 7 - Larger Than n In a program, write a function that...Ch. 7 - Drivers License Exam The local driver s license...Ch. 7 - Name Search If you have downloaded the source code...Ch. 7 - Prob. 9PECh. 7 - World Series Champions If you have downloaded the...Ch. 7 - Prob. 11PECh. 7 - Prob. 12PECh. 7 - Magic 8 Ball Write a program that simulates a...Ch. 7 - Expense Pie Chart Create a text file that contains...Ch. 7 - 1994 Weekly Gas Graph In the student sample...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
When a class member is declared as protected, what code may access it?
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Write a program to print the value of EOF.
C Programming Language
Write an SQL statement to display the last name, first name, and email of any owners of cats. Use a subquery. T...
Database Concepts (7th Edition)
Password Weakness Detector Design a program that asks the user to enter a password, and then analyzes the passw...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Translate the following instructions from English into Vole. a. LOAD register 0x6 with the value 0x77. b. LOAD ...
Computer Science: An Overview (12th Edition)
Knowledge Booster
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
- Pythonarrow_forwardPYTHON Language Programming Write a program that asks user for state name in a text document "state.txt" Please eneter a state: Georgia Georgia has been added to the list Enter another name(Y/N): Y Please enter a state: California New York is already in the list Enter another name (Y/N): N Here are the states in the file: California and Georgiaarrow_forwardC++ You should create a loop which will ask user if they want to insert, delete, display and exit. Then call the corresponding method based on the user's input. The loop will only stop once user entered "Exit" Topic: LinkedListarrow_forward
- 1. Total SalesDesign a program that asks the user to enter a store’s sales for each day of the week. Theamounts should be stored in a list. Use a loop to calculate the total sales for the week anddisplay the result.arrow_forwardBlock elements are normally displayed without starting a new line. * False O Truearrow_forwardAssume the variable authors references a list. Write a for loop that displays each author in the list.arrow_forward
- phyton Topics: list and list processing You will write a program to read grade data from a text file, displays the grades as a 5-column table, and then print the statistics (min, max, median, and median). You can assume that the input file only one number per line. You can assume the user always enter a file that exists. The median is the value in the middle of a sorted list. To sort a list, use list.sort() function. It’s computed as below. For a list of odd length, the middle number is just the length divide by 2. For the list, [1,2,3], the median is 2 since 2 is in the middle of the list. The middle index is 3//2, which is 1. Remember that // is the integer division operator. When the length of the list is even, there are two middle numbers. The median is the average of the two middle numbers. For example, [1,2,3,4], the median is (2+3)/2 = 2.5. The two middle indexes for this example are (4//2)-1 = 1 and (4//2) = 2. Functions you need to write: read_grades() Prompts…arrow_forwardAverage Number of WordsIf you have downloaded the source code from the Computer Science Portal you will find a filenamed text.txt in the Chapter 08 folder. The text that is in the file is stored as one sentenceper line. Write a program that reads the file’s contents and calculates the average number ofwords per sentence.(You can access the Computer Science Portal at www.pearsonhighered.com/gaddis.)arrow_forwardC programming c languagearrow_forward
- True or False When you create a List object, you do not have to know the number of items that you intend to store in it.arrow_forward1994 Weekly Gas GraphIn the student sample programs for this book, you will find a text file named 1994_Weekly_Gas_Averages.txt. The file contains the average gas price for each week in the year 1994.(There are 52 lines in the file.) Using matplotlib, write a Python program that reads thecontents of the file then plots the data as either a line graph or a bar chart. Be sure to displaymeaningful labels along the X and Y axes, as well as the tick marks. (in python)arrow_forwardCENGAGE MINDTAP Programming Exercise 9-2A | Instructions The mean of a list of numbers is its arithmetic average. The median of a list is its middle value when the values are placed in order. For example, if an ordered list contains 1, 2, 3, 4, 5, 6, 10, 11, and 12, then the mean is 6, and their median is 5. Write an application that allows you to enter nine integers and displays the values, their mean, and their median. An example of the program is shown below: Enter number 6 12 Enter number 7 14 Enter number 8 16 Enter number 9 18 You entered: 2, 4, 6, 8, 10, 12, 14, The mean is 10.0 and the median is 10 YE ا... | 16, 18 MeanMedian.java 1 +arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Graphical User Interfaces: Crash Course Computer Science #26; Author: CrashCourse;https://www.youtube.com/watch?v=XIGSJshYb90;License: Standard YouTube License, CC-BY
Python GUI | How To Make A GUI In Python | Best GUI Framework In Python | Edureka; Author: edureka!;https://www.youtube.com/watch?v=_PHJvjQJa3w;License: Standard Youtube License