Report Bug

Qus

What will be the output of the following Python code?

import math  [str(round(math.pi)) for i in range (1, 6)]
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


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’]


Solution
C. [‘3’, ‘3’, ‘3’, ‘3’, ‘3’]



Explanation
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’].
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad