Question: Q 4 . Write a program that defines the following two lists: names = [ ' Alice ' , 'Bob', 'Cathy', 'Dan', ' Ed '

Q4. 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 Alice's age is 20, Bob's 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 (who's in this case "Alice"). Then, your program should combine the chosen person's 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
 Q4. Write a program that defines the following two lists: names

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!