
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
19. Given the following Python code. Please describe the programming errors in the code and provide the corrections required to fix the program. Please include the line numbers for each correction. Hint: There are 3 errors in the code. Program Description: This program generates a random license place for a user specified car and store the year, make, model, and license plate in a dictionary Author: Faris Hawamdeh 11111 #Prompt the user to enter the year, make, and model of their vehicle year = int(input('Please enter the model year of your vehicle: ')) make int(input('Please enter the maker of your vehicle: ')) model=input('Please enter the model of your vehicle: ') - # Generate the 3-Letter prefix: Can be A-Z letter_a= chr(random.randint (65, 90)) letter_b = chr(random.randint (65, 90)) letter_c= chr(random.randint (65, 90)) # Generate the 4-digit number for the License plate digits = random.randint (1000, 9999) license_plate = letter_a + letter_b + letter_c + digits car = ( 'Year': year, 'Make': make, 'Model': model, 'Plate': license_plate print (f'The license plate for your {car["Year"]} {car["Make"]} {car["Model"]} is {car["Plate"]}')
![4567890HDHELYANR12BH567812
30
13
31
bad program.py
3
32
19. Given the following Python code. Please describe the programming errors in the code and
provide the corrections required to fix the program. Please include the line numbers for each
correction. Hint: There are 3 errors in the code.
Program Description:
This program generates a random license place for a user specified car and store
the year, make, model, and license plate in a dictionary
Author: Faris Hawandeh
#Prompt the user to enter the year, make, and model of their vehicle
year= int(input('Please enter the model year of your vehicle: '))
make = int(input('Please enter the maker of your vehicle: '))
model input('Please enter the model of your vehicle: ')
# Generate the 3-Letter prefix: Can be A-Z
letter_a= chr(random.randint (65, 98))
letter_ba chr(random.randint (65, 90))
letter_c= chr(random.randint(65, 90))
# Generate the 4-digit number for the License plate
digits randon.randint (1800, 9999)
license plate letter_a+ letter_b+ letter_c + digits
Ecar = (
"Year': year,
make,
'Make':
'Model': model,
"Plate': license plate
print (f'The license plate for your {car["Year"]} (car["Make"]} (car["Model"]) is (car["Plate"]}')](https://content.bartleby.com/qna-images/question/e031daf1-5c21-4921-b0ef-e4a42f46f545/0dff4ad6-76bc-45eb-8b55-fb5e4612f441/uex5grn_thumbnail.jpeg)
Transcribed Image Text:4567890HDHELYANR12BH567812
30
13
31
bad program.py
3
32
19. Given the following Python code. Please describe the programming errors in the code and
provide the corrections required to fix the program. Please include the line numbers for each
correction. Hint: There are 3 errors in the code.
Program Description:
This program generates a random license place for a user specified car and store
the year, make, model, and license plate in a dictionary
Author: Faris Hawandeh
#Prompt the user to enter the year, make, and model of their vehicle
year= int(input('Please enter the model year of your vehicle: '))
make = int(input('Please enter the maker of your vehicle: '))
model input('Please enter the model of your vehicle: ')
# Generate the 3-Letter prefix: Can be A-Z
letter_a= chr(random.randint (65, 98))
letter_ba chr(random.randint (65, 90))
letter_c= chr(random.randint(65, 90))
# Generate the 4-digit number for the License plate
digits randon.randint (1800, 9999)
license plate letter_a+ letter_b+ letter_c + digits
Ecar = (
"Year': year,
make,
'Make':
'Model': model,
"Plate': license plate
print (f'The license plate for your {car["Year"]} (car["Make"]} (car["Model"]) is (car["Plate"]}')
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

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
- (1) Create two dictionaries: one should contain bank account number as key and the customer name as value. The other should contain bank account number as key and the balance as value. (1 pt) Ex:An account dictionary with one entry: {'109': 'John Doe'} A balance dictionary with one entry: {'109': 2500.58} Create the following 4 accounts:Account #: Name: Balance ($): '109' 'John 'Doe' 2500.58 '110' 'Mary Woods' 1070.50 '111' 'Sam Brown' 7850.00 '112' 'Mark Miller' 5000.95arrow_forwardCreate a program that contains a dictionary containing 20 countries as keys and their capitals as values. ( Use the Internet if needed) 4. The program is to randomly quiz the user by displaying a country's name and ask user to enter the country's capital. 5. The program is to verify user's entry , if correct , program is to congratulate user and display another countries name. Use sentinel to allow the user to exit the program if they choose to. 6. The program should keep count of the number of correct and incorrect responses and display results when user chooses to stop playing Python codearrow_forwardStrict Warning ⚠️ don't you dare useany AI tool otherwise I'll report your accountarrow_forward
- Python code please help, indentation would be greatly appreciatedarrow_forwardDisplays a rank in the defined dictionary.a) Create a dictionary, rank = {1:"Freshman", 2:"Sophmore", 3:"Junior", 4:"Senior"}b) Request a user input for a number of years.c) Print the value of the matching key in the dictionary.d) Print the error message if input is invalid. In actual code and psuedocode. Using python programming language.arrow_forwardThis section has been set as optional by your instructor. OBJECTIVE: Write a program in Python that prints the middle value of a dictionary's values, using test_dict from the test_data.py module. NOTE: test_dict is created & imported from the module test_data.py into main.py Example 1: test dict = {'a':1,'b':9,'c':2,'d':5} prints 5 Example 2: test_dict = {'b':9,'d':5} prints 5 Hint: You may(or may not) find the following function useful: list.sort() which sorts the elements in a list. Note: the result is automatically stored in the original list, and return value from the function is None Туре list = [1, 2,3,2,1] After calling: list = [1,1,2,2,3] list.sort(), 339336.2266020 x3zgy7 LAB 13.11.1: Middlest Value (Structured Types) АCTIVITY 0/11 File is marked as read only Current file: test_data.py 1 #This module creates the test_dict to be used in main.py 2 #Reads input values from the user & places them into test_dict 3 dict_size = int(input()) #Stores the desired size of test_dict. 4…arrow_forward
- Need help answering this python question Create a dictionary of your friends that you found in 2017 and 2018. So, the keys are '2017' and '2018. For example: friend_solar = {2022: ["James", "Linda"] , 2023: ["Joshua", "Zoey"]} Print the friend's name Ask the user to enter a name of their friends. Then show the friend you found in 2022 or 2023. Ask the user to add a new friend name to the 2022 or 2023 lists (You need also to ask the user what year they want to add the friend name). Then add the entered friend name to the dictionary(2022 or 2023 value) Print the friends' dictionary on the screen.arrow_forward+|| 8 Exercise 1 (2%) Create an anonymous block that displays a course list. Declare a cursor and use the OPEN,FETCH, and CLOSE cursor statements to access the cursor. Use the %ROWTYPE attribute for the cursor. Output: Course Code Course Title Accounting Theory Microeconomics Financial Accounting Anthropology Introduction to Business Businéss Planning Web Technologies I Programming Logic Web Technologies II Python Programming Web Technologies III Database Design & SQL Communications I ACC104 ACC205 ANT100 BUS100 BUS230 CIS100 CIS105 CIS200 CIS225 00ESI) CIS400 ENG101 ENG201 GEO101 MGT410 Communication II The Physical Environment Human Resources Management Project Management Algebra Geometry Nursing Theory I Nursing Theory II MGT415 MTH120 MTH400 NSG130 NSG230 -19°C Mostly sunny ^ o prt sc home end insert delete F6 F7 F10 F11 F12 81 ) ( num backspace lock 6 } { ] enter 7. shift B. / dn 6d up 6d alt ctrl >arrow_forwardAssume the variable definitions references a dictionary. Write an if statement that determines whether the key 'marsupial' exists in the dictionary. If so, delete 'marsupial' and its associated value. If the key is not in the dictionary, display a message indicating so.arrow_forward
- As part of this assignment, the program that you will be writing will store current grades in a dictionary using course codes as keys and with values consisting of percent grades in lists. The main functions of this program are to print a student's gradebook, to drop the lowest grade in each course, print the student's gradebook again, drop the course with lowest average, and finally printing the student's gradebook again. This program requires a main function and a custom value-returning function. In the main function, code these basic steps in this sequence (intermediate steps may be missing): start with an empty dictionary that represents a gradebook and then use a while loop to allow the input of course codes from the keyboard. End the while loop when the user presses enter without entering data.within the while loop:for each course entered, use a list comprehension to generate five random integers in the range of 70 through 100. These random integers in a list represent the…arrow_forwardI am struggling with this program question for the last few hours. Could you please assist? Write a program that prompts user to enter make, model, color and year of their car. Store the input data in a dictionary and a list. The dictionary has "make", "model", "color", and "year" as keys. The dictionary values are user inputted data. In addition, store the input data in a list also. Store the make, model, color and year of the car in a list. Display the dictionary and list. Here are sample program run. Your program output message should be similar to below. Make sure use other inputs to verify the correctness of the program. What is the make of your car? Ford What is the model of your car? Taurus What is color of your car? white What is the year of your car? 1997 Car info dictionary: {'make': 'Ford', 'model': 'Taurus', 'color': 'white', 'year': 1997} Car info list: ['Ford', 'Taurus', 'white', 1997] (I am getting syntax errors all over the place) I do have tutoring sessions but I'm in…arrow_forwardExercise: Check Monster Character Exists Description In this series of exercises, you will create functions to create, modify and examine dictionaries that represent characters in an animated film, and the cast members who voice the characters. The keys of the dictionary will be character names. The values in the dictionary will be voice actor names. For this exercise, you will create a function that checks if a character is already in the dictionary. Files monsterfunctions.py : set of functions to work with monster cast dictionaries. Function Name has_character Parameters monsters: a dictionary character: a string, the name of a character Action Checks if character is a key in monsters. Return Value True if character is a key in monsters, otherwise False. Examples monsters = create_monster_cast() monsters = add_cast_member(monsters, "Mike", "William Crystal") has_character(monsters, "Mike") -> True has_character(monsters, "Sully") -> Falsearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education