Summer Holiday Home Work 2019 CS subject class 12th C
1 a) Which of the following can be used
as valid variable identifier(s) in Python?
2016
(i) 4thSum
(ii) Total (iii) Number# (iv) _Data
b) Name the Python Library modules which need
to be imported to invoke the following functions
(i) floor()
(ii) randint()
c) Rewrite the
following code in python after removing all syntax error(s). Underline each
correction done in the code.
STRING=""WELCOME
NOTE""
for S in range[0,8]: print STRING(S)
print
S+STRING
d) 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
TOTAL
CNT-=1
e) What are 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
1
a) Out of the following, find those identifiers, which cannot be used for
naming
|
||||
Variable
or Functions in a Python program:
Total*Tax, While, class, switch, 3rdRow, finally,
Column31, Total
b)
Name the Python
Library modules which
need to be
imported to invoke
the following functions
(i) sqrt() (ii)
dump()
d)
Find and write the output of the following python code:
|
||||
Values=[10,20,30,40]
|
|
|
||
for Val in Values:
|
|
|
||
for I in range(1, Val%9):
|
||||
print(I,"*",end="")
|
|
|||
print()
|
|
|
No comments:
Post a Comment