Write a python program that will ask the user for their grocery list, one item at a time, and will write it to a file called groceries.txt. The program should create a new file called groceries.txt that will contain all of the user’s groceries when opened. Step 2: Modify the python program that creates a groceries.txt file so that if the user’s favourite fruit is not on the list, the program will append it to the end of groceries.txt
Q: It is critical to understand and characterise the five key sectors that form internet governance, as…
A: Administration of the Internet Internet governance is the creation and implementation of agreed…
Q: What precisely is meant when we talk about polymorphism, and how does it work?
A: Polymorphism is one of the core concepts of object oriented programming. Polymorphism allows us to…
Q: What is the primary difference between object-oriented programming and procedural programming?
A: What is the primary difference between object-oriented programming and procedural programming?…
Q: How to install and analyze a computer system step-by-step instructions
A: Prerequisites or state of planning: This is the stage in which the developer collects all of the…
Q: Do database administrators have a duty to back up their databases, or does that duty fall on…
A: Launch: Database administrators make ensuring that databases are up and running. Database…
Q: QUESTION 2 Write a Java program corresponding to the following algorithm. 1. Get the name of a…
A: The complete solution is given below:-
Q: QUESTION 9 What is the output of the following code? 18 int x = 2, y = 9; if (x 8 y 2)…
A: We are given Java code and asked the output of it. Java code is all about if-else condition. In…
Q: Do data breaches affect cloud security? If this happens, may further measures be taken?
A: It does influence: As a consequence of a data breach, an unauthorized person acquires access to…
Q: Accessing files may be done in a variety of ways. In each case, what are the positives and…
A: The Answer start from step-2.
Q: When explaining operations that are not directly related to system analysis, you may nevertheless…
A: The first step will include the provision of structured English in order to explain procedures that…
Q: Create a real life sequential circuit that can be used on multism, it does not to be a complicated…
A: Here are some of the examples:
Q: Which alternative would be better to working with generic CASE tools if a systems analyst had to…
A: Analyst computer systems: A system analyst is responsible for processing data collected from the…
Q: When reading this article, you will learn about dynamic scoping and how to utilise it effectively,…
A: The process of declaring a variable inside the confines of a particular scope is called scoping.…
Q: -2. Give at least one real-time example of following architectural styles? Also explain each example…
A: We need to give examples of mentioned architecture styles. As per the guidelines only 1st 3 parts…
Q: Explain the arithmetic logic unit in a few words (ALU)
A: The Arithmetic Logic Unit, or ALU, is as follows: It is possible to perform arithmetic and logical…
Q: Various paradigms of programming exist, but which ones are the most common? What are some of the…
A: The programming paradigm refers to a style of programming. It is not referred to a specific…
Q: What is an information system (complete definition)? List and describe the component of an…
A: The solution to the given question is: An information system (IS) refers to a collection of…
Q: If the device can transport data to at least two wired peripheral devices attached to the computer…
A: The device must be capable of sending data at a rate of more than 300 million characters per second…
Q: Q1. Write a query to fetch the EmpFname from the Employeelnfo table in upper case and use the ALIAS…
A: Answer: we have to write query to fetch EmpFname which is employee first name from employee…
Q: What is the PictureBox control's SizeMode attribute set to by default?
A: PictureBox control's SizeMode attribute is a property of the System Windows Form.
Q: How can a computer's performance be improved
A: The answer of this question is as follows:
Q: Which type of speech parts, the below words belong to? Show the part of speech with more 1-…
A: 1. Yourself and yourselves are reflexive pronouns, being the reflexive forms of you. They can be…
Q: Data transmission protocols TCP and UPD both provide issues and opportunities in today's network…
A: TCP is connection-oriented protocol. When a file or message send it will get delivered unless…
Q: What are the major differences between software-based and hardware-based firewalls? Is one of the…
A: Software for a firewall: A software firewall is a kind of computer programme that runs on a computer…
Q: Statements that have been prepared in advance are more time-effective. Why?
A: Given: To learn more about Prepared Statements This is because prepared statements "prepare" the SQL…
Q: MyPicture is a PictureBox control in an application's graphical user interface. To hide the control,…
A: The following description pertains to the Visible property of a Picture Box: A "Picture Box" control…
Q: Computers produce a lot of heat while they're running. Distinguish between the many kinds of…
A: Computer cooling systems: Computer cooling systems are passive or active systems that control and…
Q: What are the names given to the short words used in assembly language?
A: Assembly language: A language with a low degree of abstraction is the assembly language. In order to…
Q: Structured English can be used to explain processes that have nothing to do with system analysis.…
A: Given: The act of studying a method or company to discover its objective and purposes and to build…
Q: When it comes to the Internet protocol stack, how many levels are there in total? Are there any…
A: Internet protocol stack: The Internet Protocol Suite, most frequently referred to as TCP/IP, is a…
Q: How do you really run the Data Structure programme if you're using C?
A: In this question we have to understand that how to execute data structure programme in the C…
Q: CSMA protocol in
A: Carrier Sense Multiple Access (CSMA) is a corporate network transfer protocol that operates on a…
Q: Identify the functional and non-functional needs of the information system you've chosen, and…
A: Functional and Non-functional: A functional requirement is a specification that describes a system…
Q: The moveVertical and slowMoveVertical strategies should be practiced first. Use the moveHorizontal…
A: Horizontal movement: What does it mean to make a "horizontal career move"? A horizontal career move…
Q: Give an explanation for what is causing a transmission delay.
A: To be determine: A Look at the Factors That Affect Transmission Delays There are a number of factors…
Q: 34 35 37 30 32 33 25 29 Show the output of the following Java code for values shown belo 30C publie…
A: Coded using Java language.
Q: What does it imply when someone uses this phrase to describe an assembly language?
A: Assembly language: An assembler is a programme that converts assembly language code into machine…
Q: To what degree may an attacker using a MAC modify the Tag (the MAC) and encrypted data? Because the…
A: Introduction: MAC A message authentication code (abbreviated MAC), A checksum, which is a part of…
Q: What is the LDAP protocol, and how does it function inside a public key infrastructure (PKI)?
A: Introduction: The acronym Lightweight Directory Access Protocol (LDAP) stands for Lightweight…
Q: How can you tell the difference in C++ between the basic data types and the structured data types?
A: here we have given few differences between basic data types and structured data types in C++. You…
Q: Compute the fourth order Taylor expansion for sin(x) and cos(x) and sin(x)cos(x) around 0. Write…
A: It starts with importing math and numpy library. First the value of sine series is calculated by…
Q: What's the difference between a user interface and a user interface?
A: User Interface (UI) and User Experience (UX) are two separate terms, they do not relate to each…
Q: Why should you not use printf() when constructing a signal handler?
A: When creating a single handler, we should avoid using printf() because 1. It does not allow reentry.…
Q: How many RadioButton controls may be chosen at a time if they're all in the same GroupBox?
A: here in question statement is given about radio button and i have to answer it.
Q: When comparing bytecode vs assembly language, what should you look for?
A: Bytecode: This is a medium-level language. Humans are unable to read this. This necessitates the use…
Q: What are the benefits and drawbacks of using the cloud to store data? Please provide some instances…
A: Please find the answer below :
Q: ROM and RAM are very important for computer data processing and storage. Discuss about ROM and RAM.
A: Random Access (RAM) memory is used to store programs and data used by the CPU in real-time. Data in…
Q: 3. Given a map, there are minefields and safe areas on the map. Find the largest minefield on the…
A: Since, no language is mentioned, I have implemented the above problem in C++ language. The Code in…
Q: What are some of the distinguishing features of object-oriented programming? Copies of answers will…
A: Object-Oriented Programming is a programming paradigm which has specified features which the…
Q: It is unknown how quantum computing will affect programming.
A: Quantum computers are exceedingly difficult to engineer, build and program.
step 1:
Write a python program that will ask the user for their grocery list, one item at a time, and will write it to a file called groceries.txt. The program should create a new file called groceries.txt that will contain all of the user’s groceries when opened.
Step 2:
- Modify the python program that creates a groceries.txt file so that if the user’s favourite fruit is not on the list, the program will append it to the end of groceries.txt file.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 5 images
- Write a program that will ask the user for their grocery list, one item at a time, and will write it to a file called groceries.txt. The program should create a new file called groceries.txt that will contain all of the user’s groceries when opened.step 1: Write a program that will ask the user for their grocery list, one item at a time, and will write it to a file called groceries.txt. The program should create a new file called groceries.txt that will contain all of the user’s groceries when opened. Step 2: Modify the program that creates a groceries.txt file so that if the user’s favourite fruit is not on the list, the program will append it to the end of groceries.txt file.Write a program that does the following: Reads information from a text file into a list of sublists. Be sure to ask the user to enter the file name and end the program if the file doesn’t exist. Text file format will be as shown, where each item is separated by a comma and a space:ID, firstName, lastName, birthDate, hireDate, salary Store the information into a list of sublists called empRoster. EmpRoster will be a list of sublists, where each sublist contains the information for one employee.The birthDate and hireDate in file are strings, but should be stored as objects of type Date.Example of EmpRoster list with 2 employees:[ [111,”Joe”, “Jones”, “09-01-1980”,”10-19-1999”, 95000], \ [222, “Sam”, “Smith”, “07-10-1956”,, “01-01-2000”, 50000] ] Print a report that shows the following: Employee RosterID First Name Last Name Birth Date Age Hire Date YrsWorked Salary WRITE the following information out to a text file…
- Write a python program that will ask the user for their grocery list, one item at a time, and will write it to a file called groceries.txt. The program should create a new file called groceries.txt that will contain all of the user’s groceries when opened.in python. Write a function named file_sum that takes as a parameter the name of a text file that contains a list of numbers, one to a line, like this: 23.77 116 94 -12.8 0 14.999 The function should sum the values in the file and write the sum (just that number) to a text file named sum.txt.Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program prints the line associated with that number. An example file and the program input and output is shown below: example.txt Line 1.Line 2.Line 3. Enter the input file name: example.txt The file has 3 lines. Enter a line number [0 to quit]: 2 2 : Line 2. The file has 3 lines. Enter a line number [0 to quit]: 4 ERROR: line number must be less than 3. The file has 3 lines. Enter a line number [0 to quit]: 0 Make sure the program gracefully handles a user entering a line number that is too high.
- Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program prints the line associated with that number. An example file and the program input and output is shown below: example.txt Line 1.In Java Oleae nust read a file A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txt and the contents of ParkPhotos.txt are: Acadia2003_photo.jpg AmericanSamoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns2010_photo.jpg CraterLake1996_photo.jpg GrandCanyon1996_photo.jpg IndianaDunes1987_photo.jpg LakeClark2009_photo.jpg…python my_list.txt: 150+250 Which code block writes the sum in a new line of the file? a. with open('my_list.txt', 'r+') as file: line = file.readline() sum = 0 for i in line.split(): sum = sum + int(i) file.write(str(sum)) b. with open('my_list.txt', 'r+') as file: line = file.readline() sum = 0 for i in line.split('+'): sum = sum + i file.write(str(sum)) c. with open('my_list.txt', 'r+') as file: line = file.readline() for i in line.split('+'): sum = sum + int(i) file.write(str(sum)) d. with open('my_list.txt', 'r+') as file: line = file.readline() sum = 0 for i in line.split('+'): sum = sum + int(i) file.write(str(sum))
- Write a program that reads student data from a file, compute their GPA and writes the results to a different file. 1. The user should have the option to either enter their text file that contains the student grades or use the provided text file that contains theinformation. The data in "indata.txt" should look similar to this, Lara_Croft75 70 91 69 89Chris_Redfield68 88 79 85 94Johnny_Cochran69 98 95 77 80Wanda_Maximoff84 86 98 95 92Luke_Skywalker74 96 80 98 97William_Kurt89 52 99 81 58Samuel_Jackson50 96 50 64 95END_OF_FILE This is supposed to be in python. This is what I have so far. I have no experience I apologise. I am trying to finish the GPA calculating program currently but am having trouble finishing it. grade = input("enter grades")points = 0 if grade is 90-99:total_points = 4.0if grade is 80-89:total_points = 3.0if grade is 70-79:total_points = 2.0if grade is 60-69:total_points = 1.0if grade is 50-59:total_points = 0.0gpa = total_points/len(grade)print(gpa,"is gpa")Write a program called p1.py that contains a function called filereader() that takes a number n (int) and a filename (string) as input. The function should read and store every nth line of the file in a list and return it.Test your function inside the main function (don’t forget the main guard).Sample output with “samplefile_t8.txt” file. It contains the following lines of text.kangaroo, 5capybara, 7wombat, 2koala, 3wallaby, 4quokka, 5platypus, 9dingo, 2kookaburra, 1>>> filereader(“samplefile_t8.txt”, 3) returns[“wombat, 2”, “quokka, 5”, “kookaburra, 1”]Please do this in Python: Write a program that allows the user to navigate lines of text in a file. The program should prompt the user for a filename, read the file and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line number range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program prints the text associated with that number.