Sponsor Area
Review Of Phython
Name the Python Library modules which need to be imported to invoke the following functions
(i) floor()
(ii) randint()
Python Library modules which need to import to invoke the given functions are:
(i) math
(ii) random
Some More Questions From Review of Phython Chapter
Find and write the output of the following python code:
TXT = ['20','50','30','40']
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float (T) + C
print
TXT = ['20','50','30','40']
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float (T) + C
printFind and write the output of the following python code:
class INVENTORY:
def __init__(self,C=101,N='Pad',Q=100): #constructor
self.Code=C
self.IName=N
self.Qty=int(Q);
def Procure(self,Q):
self.Qty = self.Qty + Q
def Issue(self,Q):
self.Qty -= Q
def Status(self):
print self.Code,':',self.IName,'#',self.Qty
I1=INVENTORY()
I2=INVENTORY(105,'Thumb Pin',50)
I3=INVENTORY(102,'U Clip')
I1.Procure(25)
I2.Issue(15)
I3.Procure(50)
I1.Status()
I3.Status()
I2.Status()
class INVENTORY:
def __init__(self,C=101,N='Pad',Q=100): #constructor
self.Code=C
self.IName=N
self.Qty=int(Q);
def Procure(self,Q):
self.Qty = self.Qty + Q
def Issue(self,Q):
self.Qty -= Q
def Status(self):
print self.Code,':',self.IName,'#',self.Qty
I1=INVENTORY()
I2=INVENTORY(105,'Thumb Pin',50)
I3=INVENTORY(102,'U Clip')
I1.Procure(25)
I2.Issue(15)
I3.Procure(50)
I1.Status()
I3.Status()
I2.Status()What is the possible outcome(s) executed from the following code? Also, specify the maximum and minimum values that can be assigned to variable N.
import random
NAV = ['LEFT','FRONT','RIGHT','BACK'];
NUM = random.randint(1,3)
NAVG = ''
for C in range(NUM,1,-1):
NAVG = NAVG+NAV[I]
print NAVG
(i)BACKRIGHT
(ii)BACKRIGHTFRONT
(iii) BACK
(iv) LEFTFRONTRIGHT
import random
NAV = ['LEFT','FRONT','RIGHT','BACK'];
NUM = random.randint(1,3)
NAVG = ''
for C in range(NUM,1,-1):
NAVG = NAVG+NAV[I]
print NAVG
Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.
Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:
_Cost, Price*Qty, float, Switch,
Address One, Delete, Number12, do
Address One, Delete, Number12, do
Name the Python Library modules which need to be imported to invoke the following functions
(i) load()
(ii) pow()
(i) load()
(ii) pow()
Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.
for Name in [Amar, Shveta, Parag]
IF Name[0]='S':
print(Name)
for Name in [Amar, Shveta, Parag]
IF Name[0]='S':
print(Name)Find and write the output of the following python code:
Numbers=[9,18,27,36]
for Num in Numbers:
for N in range(1, Num%8):
print(N,'#',end= '' )
print()
Numbers=[9,18,27,36]
for Num in Numbers:
for N in range(1, Num%8):
print(N,'#',end= '' )
print()Find and write the output of the following python code:
class Notes:
def __init__(self,N=100,Nt='CBSE'): #constructor
self.Nno=N
self.NName=Nt
def Allocate(self, N,Nt):
self.Nno= self.Nno + N
self.NName= Nt + self.NName
def Show(self):
print(self.Nno,'#',self.NName)
s=Notes()
t=Notes(200)
u=Notes(300,'Made Easy')
s.Show()
t.Show()
u.Show()
s.Allocate(4, 'Made ')
t.Allocate(10,'Easy ')
u.Allocate(25,'Made Easy')
s.Show()
t.Show()
u.Show()
Find and write the output of the following python code:
class Notes:
def __init__(self,N=100,Nt='CBSE'): #constructor
self.Nno=N
self.NName=Nt
def Allocate(self, N,Nt):
self.Nno= self.Nno + N
self.NName= Nt + self.NName
def Show(self):
print(self.Nno,'#',self.NName)
s=Notes()
t=Notes(200)
u=Notes(300,'Made Easy')
s.Show()
t.Show()
u.Show()
s.Allocate(4, 'Made ')
t.Allocate(10,'Easy ')
u.Allocate(25,'Made Easy')
s.Show()
t.Show()
u.Show()What are the possible outcome(s) executed from the following code? Also, specify the maximum and minimum values that can be assigned to variable PICKER.
import random
PICK=random.randint(0,3)
CITY=['DELHI','MUMBAI','CHENNAI','KOLKATA']
for I in CITY:
for J in range(1,PICK):
print(I,end='')
print()
i
ii
DELHIDELHI
MUMBAIMUMBAI
CHENNAICHENNAI
KOLKATAKOLKATA
DELHI
DELHIMUMBAI
DELHIMUMBAICHENNAI
iii
iv
DELHI
MUMBAI
CHENNAI
KOLKATA
DELHI
MUMBAIMUMBAI
KOLKATAKOLKATAKOLKATA
import random
PICK=random.randint(0,3)
CITY=['DELHI','MUMBAI','CHENNAI','KOLKATA']
for I in CITY:
for J in range(1,PICK):
print(I,end='')
print()MUMBAIMUMBAI
CHENNAICHENNAI
KOLKATAKOLKATA
DELHIMUMBAI
DELHIMUMBAICHENNAI
MUMBAI
CHENNAI
KOLKATA
MUMBAIMUMBAI
KOLKATAKOLKATAKOLKATA
Sponsor Area
Mock Test Series
Mock Test Series



