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 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz