Question: Write code that sets the value of a variable called name depending on the numeric value in the variable id. If id is 1, set

Write code that sets the value of a variable called name depending on the numeric value in the variable id. If id is 1, set name to 'Alice', if id is 2, set name to 'Bob', if id is 3, set name to 'Carol', and if id is 4, set name to 'David'. If the id is anything else, set name to 'Unknown'. Assume that the variable id has already been initialized (code in python).

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!