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
Get step-by-step solutions from verified subject matter experts
