Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 3PE
Program Plan Intro
Tracking conference attendees
Program plan:
- Import the package.
- Create a class “Conference_Manager”,
- Define the “_init_()” function,
- Create empty list.
- Open the input file in read mode.
- Read all the characters from the file using “read()”.
- Parse the json string using “json_loads()”.
- Create a “for” loop to iterate all the keys which are obtained from “json_object”.
- Assign initial values by invoking “_init_()”.
- Append the value at the end of the list.
- Close the input file.
- Define the getter method “get_JSON()”,
- Return the key, value pairs get from “json_object”.
- Define the getter method “get_Attendee()”,
- Create “for” loop to iterate over elements of list.
- Check whether the value return from “get_Name()” is equal to the value stored in “name,
- Return the list.
- Check whether the value return from “get_Name()” is equal to the value stored in “name,
- Create “for” loop to iterate over elements of list.
- Define the getter method “find_ByState()”,
- Create a list.
- Create “for” loop to iterate over elements of list.
- Check whether the value return from “get_State()” is equal to the value stored in “state”,
- If it is true, append the value to the end of the list.
- Check whether the value return from “get_State()” is equal to the value stored in “state”,
- Return the list.
- Define the getter method “make_Attendee()”,
- Assign the value to the list return from “_init_ ()” method from Attendee class.
- Append the value to the end of the list.
- Define the method “del_Attendee()”,
- Create for loop,
- Check whether the name is return from “get_name()”,
- If it is true, remove the element using “pop()”.
- Check whether the name is return from “get_name()”,
- Create for loop,
- Define the method “update_Conference()”,
- Create a list.
- Create for loop,
- Check whether the name is return from “get_name()”,
- Append the value to the end of the list.
-
- Open the output file in write mode,
- Serialize the object as a JSON formatted stream using “json_dump()”.
- Open the output file in write mode,
- Check whether the name is return from “get_name()”,
- Define the “_init_()” function,
- Create a class “Attendee”,
- Define the function “_init_()”,
- Assign the initial values for the variables.
- Define the getter method “get_Name()” to return the value stored in “name”.
- Define the getter method “get_Company()” to return the value stored in “company”.
- Define the getter method “get_State()” to return the value stored in “state”.
- Define the getter method “get_Email()” to return the value stored in “email”.
- Define the method “display_Info()” to print the formatted output.
- Define the function “_init_()”,
- Define the “main()” function,
- Call the constructor to initialize the values.
- Call “make_Attendee()” function.
- Assign the value return from “get_Attendee()”.
- Assign the value return from “find_ByState()”.
- Print the value return from “get_Company()”.
- Print the value return from “get_Name()”.
- Print the value return from “get_Sate()”.
- Print the value return from “get_Email()”.
- Call the function “display_Info()”.
- Create for loop,
- Print the value return from “get_Name()”.
- Call the “main()” function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
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")
You are a cyber investigator, your task is to write a python program that can read file signatures from a file and save them into a list. Each file signature is an element of your list. Then, try to find out if there is a JPG file in there. If there is a JPG file, print out a True on screen. (File Signature for JPG file is: FF D8 FF DB)
The input file is: FSCS360_Midterm_Exam_Part2.txt
Write a program that will sequentially list numbers from 0 to 50, changing its color depending on the size of the number, for example, for numbers from 0 to 10 it will be green, 11 to 22 red and 23 to 35 blue, etc. Limit the screen output speed to about 1 character / second.
In order to change colors, you must first use the GetStdHandle function to get a handle to the console, which is similar to getting a file pointer before working with a file. It is done e.g. as follows:
HANDLE hConsole; hConsole = GetStdHandle (STD_OUTPUT_HANDLE);
The above functions are defined in windows.h
Tip 2: Write a utility to find out the colors corresponding to all combinations from 0 to 255.
Tip 3: Instructions and sample program for working with time.
C language plz with explanation of codes. thanks
Chapter 12 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
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
- Write an address book program that stores your contacts' names and their email addresses. The names and email addresses are originally stored in a file called phonebook.in, in the format: Harry Pottertheboywholived@hogwarts.eduHermione Grangerbrightestwitch@hogwarts.eduRon Weasleyroonilwazlib@hogwarts.eduDraco Malfoymyfatherwillhearaboutthis@hogwarts.eduSeverus Snapehalfbloodprince@hogwarts.eduAlbus Dumbledorealasearwax@hogwarts.edu Your program should read from the file, storing the names and corresponding email addresses in a dictionary as key-value pairs. Then, the program should display a menu that lets the user enter the numbers 1 through 5, each corresponding to a different menu item: 1) look up an email address2) add a new name and email address3) change an email address4) delete a name and email address5) save address book and exit When the user enters 1, the program should prompt them for a name, and then print the corresponding email address. If there is no dictionary entry…arrow_forwardWrite an address book program that stores your contacts' names and their email addresses. The names and email addresses are originally stored in a file called phonebook.in, in the format: Harry Potter t..d@hogwarts.edu Hermione Granger b..h@hogwarts.edu Ron Weasley r..b@hogwarts.edu Draco Malfoy m..s@hogwarts.edu Severus Snape h..e@hogwarts.edu Albus Dumbledore a..x@hogwarts.edu Your program should read from the file, storing the names and corresponding email addresses in a dictionary as key-value pairs. Then, the program should display a menu that lets the user enter the numbers 1 through 5, each corresponding to a different menu item: 1) look up an email address 2) add a new name and email address 3) change an email address 4) delete a name and email address 5) save address book and exit When the user enters 1, the program should prompt them for a name, and then print the corresponding email address. If there is no dictionary entry under that name, the program should print, "Sorry,…arrow_forwardWrite a program to compute Letter grades for a course. The course records are in a file that will serve as the input file. Each line of the file contains a student’s last name, then one space, quiz scores, All on one line. The program should ask the instructor about the grading scheme. Based on the input grades and the grading scheme, the system will print out for the instructor the final letter grades for all students. The instructors can choose an option to save all the grades in a text file.arrow_forward
- Write a program that reads student information from a text file, then creates a text file that records the course grades of the students and a final grade. Each row of the .txt file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student, each separated by a space. A sample of the student information is provided in StudentInfo.txt below. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: • Read the file name of the .txt file from the user. • Open the .txt file and read the student information using readline() or readlines(). • Compute the average exam score of each student. • Assign a letter grade to each student based on the average exam score in the following scale: ◦ A: 90 =< x ◦ B: 80 =< x < 90 ◦ C: 70 =< x < 80 ◦ D: 60 =< x < 70 ◦ F: x < 60 • Output the first names, last names, exam scores, and letter…arrow_forwardPlease write a program that reads the file, then removes any missing data and prints it out. You should be able to see a DataFrame like the one below:arrow_forwardWrite a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this and so should your output file. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. This would be the folder that contains the src folder, probably named FileCopy depending on what name you gave the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line and write the file itself.arrow_forward
- The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%, D; and…arrow_forwardWrite a program called ReverseText.exe that takes two file names as command-line arguments. TheReverseText program should reads the characters from the first file and write them into the second file inreverse order. Test your program out using the small text file iso_8859-1.txt provided with thisassignment. Once you are confident that your program is working correctly, run it on the much larger fileWar_of_the_Worlds.txt uploaded along with this assignment. For example, when you use this program on the command line it should be like this:ReverseText.exe War_of_the_Worlds.txt War_of_the_Worlds_reversed.txt Remember, if you are using fgets(), it will only return one line of the book at a time. You willhave to go through the book multiple times and make frequent use of the rewind() function.HintYou can use the strlen() function (that is part of the string.h C Standard Library) to check thelength of the string you read in using fgets(). ALSO, if you could please help me know and…arrow_forwardUsing PyCharm, create a new Project lab12. Under lab12 create a new Directory exercise,then create a Python file called name.py in which to write a class named Name. This classholds the entire name of a person, that is, first, middle and last names and a suffix, andkeeps count of how many of these names are being used (this is explained below).1. The class has the following fields: count, first, middle, last and suffix.2. The class has a constructor that receives one string parameter named name whosedefault value is an empty string (that is, calling the constructor with no parameterssets the value of name to an empty string). The constructor initializes all fields basedon the value of name, as explained next:– The value of count depends on the number of words in name. For example,given the name Robert John Downey Jr then count is 4.– If name has one word then it has a first name.– If name has two words then it has a first and last names in that order.– If name has three words then it…arrow_forward
- Write a program in Python that reads student information from a text file, then creates a text file that records the course grades of the students and a final grade. Each row of the .txt file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student, each separated by a space. A sample of the student information is provided in StudentInfo.txt below. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: • Read the file name of the .txt file from the user. • Open the .txt file and read the student information using readline() or readlines(). • Compute the average exam score of each student. • Assign a letter grade to each student based on the average exam score in the following scale: ◦ A: 90 =< x ◦ B: 80 =< x < 90 ◦ C: 70 =< x < 80 ◦ D: 60 =< x < 70 ◦ F: x < 60 • Output the first names, last names, exam scores, and letter grades of the students into a text file named…arrow_forwardC++ PLEASE!! Working on a project that is about word count with MapReduce, need a file manager class to take care of reading all txt file from a directory with giving path. The file manager class need to open the directory with the giving path which the user will input, then open the path and open all the txt files in that directory and break the text into single line and pass it to another class to do mapping. Please help with the file manager class!! Thank you!!arrow_forwardWrite a program that reads two input files whose lines are ordered by a key data field. Your program should merge these two files, writing an output file that contains all lines from both files ordered by the same key field. As an example, if two input files contain student names and grades for a particular class ordered by name (the key field), merge the information as shown below. File 1 and file 2 are supplied. Here is an algorithm to merge the data from two files: Read a line from each data file While the end of both files has not been reached While the end of both files has not been reached Write the line from file 1 to the output file and read a new line from file 1. Else Write the line from file 2 to the output file and read a new line from file 2. Write the remaining lines (if any) from file 1 to the output file. Write the remaining lines (if any) from file 2 to the output file. See the Merging Filesslides attachedto the project in Canvasfor a visual look at this algorithm.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License