Sail E0 Webinar
Question
What is the output of the following piece of code?a=list((45,)*4)print((45)*4)print(a)
Options:
A .  180[(45),(45),(45),(45)].
B .  (45,45,45,45).[45,45,45,45].
C .  180[45,45,45,45].
D .  Syntax error
Answer: Option C


(45) is an int while (45,) is a tuple of one element. Thus when a tuple is multiplied, it created references of itself which is later converted to a list.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers