What will be the output of the following Python code?
There is a class in which students' ages are determined by their t-shirt categories which are small, medium, and large. If there are two students ages 8 and 12 respectively, what would be the size of their t-shirt category? Provide the output based on the following Python code:-
Def mystery(num):
If num > 10:
Return “Big”
Elif num > 5:
Return “Medium”
Else:
Return “Small”
Result = mystery(8) + “ “ + mystery(12)
Print(result)
In the context of Python, the answer for what will be the output of the following Python code is here which is the outcome given for your specific scenario:-
Def mystery(num):
If num > 10:
Return “Big”
Elif num > 5:
Return “Medium”
Else:
Return “Small”
Result = mystery(8) + “ “ + mystery(12)
Print(result)
The output will be
“ Medium Big”
Hence the output is that the t-shirt size which is assigned for the boy whose age is 8 years would be ‘medium’ category, while the size assigned for the 12-year-old boy would be ‘big’ category.
Level up your career with python certification! Start your journey to success today. Enroll now and unleash your full potential!