Question: WRITE IN PYTHON: Write a function zbini _ attrs ( type _ id ) that converts a Zoomerbini type ID to a tuple of strings
WRITE IN PYTHON:
Write a function zbiniattrstypeid that converts a Zoomerbini type ID to a tuple of strings representing the four underlying attributes in the following order: Hairhat style, favourite colour, fashion accessory and preferred social media platform.
Here are the possible values as string literals for each attribute:
HairHat: "wavy", "curly", "cap" or "beanie"
Colour: "red", "blue", "yellow" or "green"
Accessory: "sneakers", "bowtie", "scarf" or "sunglasses"
Social: "tiktok", "instagram", "snapchat" or "discord"
The parameter typeid may be assumed to be a numeric whole number value integer The returned attributes for a given ID should match those shown in the full mapping table in all cases.
If a typeid outside the valid range is given, the function should instead return None.
Hint: There are multiple ways to solve this problem, but regardless of which one you pick, ensure that it is not overly redundant. In particular, you should be trying to identify patterns in the way that type ID numbers map to Zoomerbini attributes and computing a result based on these in a concise and well structured manner.
Example Calls:
printzbiniattrs
wavy 'red', 'sneakers', 'tiktok'
printzbiniattrs
curly 'yellow', 'sneakers', 'tiktok'
printzbiniattrs
None
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
