Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

4.3 Stay under 80 characters on all code and comment lines Ask for input() with descriptive prompts telling users what is expected o Especially remember

4.3 Stay under 80 characters on all code and comment lines Ask for input() with descriptive prompts telling users what is expected o Especially remember to tell user what delimiter youre expecting when using split() Make sure to validate user input for data type, value range and other problem requirements Print output that clearly explains what is being printed (where necessary) o In other words, dont just print a 5 unless its clear what that 5 represents. Import statements should be immediately after the program docstring Make sure to include # line comments (just a few in each program, dont go crazy) Use snake_case (lower case plus underscores) for variables CONSTANT variables must be all upper case and immediately following any import statements Do NOT create user defined functions for this assignment. Only base python functions and methods can be used, along with those in the modules listed below. Modules Allowed You may only import the following modules into your programs and use their methods and attributes, unless first receiving special (and unlikely) permission from your facilitator: math operator os re string sys THE question is

4.3 Write a python program that merges two lists into a dictionary as described below a. Create 2 constant lists. One with first names and another of last names. b. Validate that the last name list is the same size or larger than the first name list If not, exit with an error message. c. Use zip function to create a dictionary with the last names as keys and the first names as values If there are more last names than first names, set the missing first names to None (not a string) d. Print the input lists and generated dictionary with appropriate descriptions. Example of Output: First Names: ['Jane', 'John'] Last Names: ['Doe', 'Deer', 'Black'] Name Dictionary: {'Doe': 'Jane', 'Deer': 'John', 'Black': None}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions