Item Counter
Assume a file containing a series of names (as strings) is named names.txt and exists on the computer’s disk. Write a
Trending nowThis is a popular solution!
Learn your wayIncludes step-by-step video
Chapter 6 Solutions
EBK STARTING OUT WITH PYTHON
Additional Engineering Textbook Solutions
Artificial Intelligence: A Modern Approach
Starting out with Visual C# (4th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
- Pressure Unit ConversionsWrite a program that converts a value in Torr into Kilopascal. Both of these are units used to measure pressure. Use the following formula to covert Torr to Kilopascal: 1 Torr = 132/1000 KiloPascalsYour Program must use a loop to display a table of the quantities in Torr from 1 to 10 and their KiloPascal equivalents.arrow_forwardWrite code that does the following: Opens a file named NumberList.txt, uses a loop to write the numbers 1 through 100 to the file, and then closes the file. Opens the NumberList.txt file and reads all of the numbers from the file and displays them, and then closes the file. Opens the NumberList.txt file and reads all of the numbers from the file, calculate the sum of these numbers and displays their total. Opens a file named NumberList.txt for writing, but does not erase the contents of the file if it already exists.arrow_forwardRead Algorithm And then solve it's partsarrow_forward
- A for statement is a loop that goes through a list of things. Therefore, it keeps running as long as there are objects to process. Is this a true or a false statement?arrow_forwardA ______ value is a special value that is used to terminate a loop when a set of data is being entered. Select one: a. Break b. Marker c. Control d. Sentinelarrow_forwardPYTHON QUESTION ASSIGNMENT REQUIREMENTS This assignment requires a dictionary of state abbreviations and their capital cities. The abbreviations are the keys and the state capitals are the values. Start by entering data for any four states of your choice. Then, report this count but use a function to get the count. Use a while loop to add more abbreviations and capitals. The loop should continue until the user presses Enter when prompted for an abbreviation. Inside the while loop: If the state entered is already in the dictionary, report its capital. If it is not in the dictionary, prompt the user to enter the capital for that state and add it to the dictionary After the while loop ends: Report again the count of the number of states in the dictionary. Using another loop and the items() method, display all the state abbreviations and their capitals. In the same Python program write this code, although it has nothing to do with the states code. Using a dictionary…arrow_forward
- What does the following python code do? f = open("sample.txt", "a") Choose all that apply. Select 3 correct answer(s) Question 15 options: opens a file called sample.txt for reading reads the file called sample.txt starting from the top writes "a" to the file called sample.txt opens a file called sample.txt for appending If the file called sample.txt exists, it writes at the bottom of the file closes a file called sample.txt if the file sample.txt exists, deletes everything in it if the file sample.txt does not exist, it creates the file and opens it for writingarrow_forwardTranscribed Image Text Create a program that allows the user to do some basic functions. First, ask the user if they would like to find out sqrt, log or factorial of a number, then return the results. Here is the sample output: Welcome to the simple math helper. What would you like to calculate? 1. Sqrt 2. Log 3. Factorial > 1 Enter the number to sqrt: >9arrow_forwardWhat form of object should be created if you want to read data from a text file?arrow_forward
- SEARCH CANDIDATE BY QUALIFICATION Search an Election Candidate Write a program to display the election candidate details from the file to the console. Read the qualification detail from the console and search the candidates corresponding to the qualification from the file and display the details. Format of the file.txt file Rajkumar,32,BSc,Chennai Chandrabose,30,BEd,Chennai Tamil Selvan,27,BSc,Chennai Ramkumar, 26,BE,Chennai Selvan,27,BEd,Chennai Pratap Raj,34,BSc,Chennai Input Format: First line of the input consists of qualification. Output Format: Display the Election Candidate Detailsarrow_forwardDistance File Modify the Distance Calculator program that you wrote for Programming Problem 1 so it writes its output to a file instead of displaying it in a ListBox control. Open the file in Notepad or Visual Studio to confirm the output.arrow_forward17. Math Tutor Write a program that can be used as a math tutor for a young student. The program should display two random numbers to be added, such as 247 +129 The program should then pause while the student works on the problem. When the student is ready to check the answer, he or she can press a key and the program will display the correct solution: 247 +129 376arrow_forward
- 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