12CS_ProgramBasedTest1
12CS_ProgramBasedTest1
LESSONS – 5, 6 & 7
WRITE THE OUTPUT OF THE FOLLOWING SNIPPETS. / பின்வரும் குறிமுறைகளின் வெளியீட்டை எழுதுக.
1) >>> 2 5
2) >>>100//3
4) >>> print("\"Python\"")
5) a = -5
x="even" if a%2==0 else "odd"
print (a, " is ",x)
6) i=10
while (i<=15):
print (i,end='\t')
i=i+1
7) i=10
while (i<=15):
i=i+1
print (i,end='\t')
8) for x in (1,2,3,4,5):
print("Tech Easy")
9) for x in (1,2,3,4,5):
print(x, end=' ')
13) i=1
while (i<=6):
for j in range (1,i):
print (j,end='\t')
print (end='\n')
i += 1
14) i=1
while (i<=6):
for j in range (1,i):
print (‘$’,end='\t')
print (end='\n')
i += 1
15) i=1
while True:
if i%5 == 0:
break
print(i,end=' ')
i +=1
21) c = 1
def add():
c = c + 2
print(c)
add()
22) c = 1
def add():
global c
c = c + 2
print (c)
add()
23) x = 0
def add():
global x
x = x + 5
print ("Inside add() function x value is :", x)
add()
print ("In main x value is :", x)
26) n1=17.89
print (round (n1))
print (round (n1,0))
print (round (n1,1))
print (round (n1,2))
27) x=26.7
print(math.floor(x))
print(math.ceil(x))
29) print(pow(3,2))
print(pow(-3,2))
print(pow(-3,3))
30) print(abs(-8))
print(abs(8))