Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that defines the following two lists: names = [ ' Alice ' , 'Bob', 'Cathy', 'Dan', ' Ed ' , 'Frank','Gary', 'Helen',

Write a program that defines the following two lists:
names =['Alice', 'Bob', 'Cathy', 'Dan', 'Ed', 'Frank','Gary', 'Helen', 'Irene', 'Jack', 'Kelly', 'Larry'] ages =[20,21,18,18,19,20,20,19,19,19,22,19]
These lists match up, so Alices age is 20, Bobs age is 21, and so on. Write a program that asks the user to input the number of the person to retrieve the corresponding data from the lists. For example, if the user inputs 1, this means the first person whose data is stored in index 0 of these lists (whos in this case Alice). Then, your program should combine the chosen persons data from these two lists into a dictionary. Then, print the created dictionary. If 3 is the entered input, the output should be:
{name: 'Cathy',age: 18}
Hint:
Recall that the function input can retrieve a keyboard input from a user. The signature of this function is as follows:
user_input_value = input("Your message to the user")
N.B.: user_input_value is of type String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Question

Fingerprint evidence is admissible in court. Should it be?

Answered: 1 week ago

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago