Report Bug

Qus

What will be the output of the following Python code?

  l=[]  def convert(b):      if(b==0):          return l      dig=b%2      l.append(dig)      convert(b//2)  convert(6)  l.reverse()  for i in l:      print(i,end="")
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. 011
B. 110
C. 3
D. Infinite loop


Solution
B. 110



Explanation
The above code gives the binary equivalent of the number.
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