Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started