Page 198 - Computer Science Class 11 Without Functions
P. 198
9. WhnSlwiaalbtlShtlouSpuSlproductdlwhtnlShtlfoaaowinglcodtlttgetnSlitltxtcuStd?
n = 20
if n > 10:
if n > 15:
n = n-15
else:
pass
elif n < 6:
if n != 0:
print('non-zero')
print(n)
Ans: 5l
10. DtStreintlShtltrrorlnttocinStdlwiShlShtlfoaaowinglpitctloflcodtltnipptSt:
(i)l If value == 10:
square = value*value
(ii)l if value == 10
square = value*value
(iii)lif value == 10:
square = value*value
print("The square of ", value,"is",square)
else:
print("Wrong value entered")
Ans: (i)l IncorrtcSlcnttloflktywordtl– if, elif nndlelse
If value == 10:lllllllllllllllllllllllllllllllllllll------l>l'I'loflktywordliflitlinlupptrlcntt'
l square = value*value
(ii)l ThtlhtndtrlitlnoSlStreinnStdlwiShlnlcoaonl(:)
if value == 10 llllllllllllllllllllllllllllllllllllllllllllllll---l>lcoaonleitting
l square = value*value
(iii)lNoSlindtnSinglShtltSnStetnStloflif / else / elif baocktlcorrtcSay
if value == 10:
l square = value*value
print("The square of ", value,"is",square)l--->WronglindtnSnSion
else:
print("Wrong value entered")
11. RtwriStlShtlfoaaowinglcodtlSolenktliSltxtcuSnbatlbylchnngingljutSlontlSoktn.
if x = 10:
print(x)
elif:
print(x*x)
Ans. if x == 10:
print(x)
else:
print(x*x)
12. FindlShtlouSpuSloflShtlfoaaowinglcodtltnipptSlforlShtlfoaaowinglvnauttloflytnrlprovidtdlbylShtluttr:
n. 2020lllllllllllllllllb. 2051lllllllllllllc. 2100
year = int(input('Enter the year of Christian Era:'))
if year % 100 == 0:
196 Touchpad Computer Science-XI

