Sail E0 Webinar
Question
What is the output of the code shown below?import math[str(round(math.pi)) for i in range (1, 6)]
Options:
A .  ['3', '3', '3', '3', '3', '3']
B .  ['3.1', '3.14', '3.142', '3.1416', '3.14159', '3.141582']
C .  ['3', '3', '3', '3', '3']
D .  ['3.1', '3.14', '3.142', '3.1416', '3.14159']
Answer: Option C


The list comprehension shown above rounds off pi(3.141) and returns its value, that is 3. This is done 5 times. Hence the output is: ['3', '3', '3', '3', '3'].



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers