Xii CS W2 - Python Basic and Random
Xii CS W2 - Python Basic and Random
WORKSHEET - 2
5 Differentiate between Syntax Error and Run time Error. Also write a
suitable example in Python to illustrate both.
6
7 Given the following declaration:
Myd={„empno‟:1,‟name‟:‟Vikrant‟,‟salary‟:50000}
14 x="abAbcAb
a" for w
in x:
if w=="a":
print("*")
else:
print(w)
15 What will be the output of following
python code: num=1
while num==1:
print(num) num+=1
print(num*10)
16
29 Output?
def myfunc(a): a = a + 2
a = a * 2 return a
print(myfunc(2))
30 Output?
def example(a): a = a + '2'
a = a*2
return a
example("hello")