Python Fundamentals
Python Fundamentals
Computer Science(083)
CH 7 : PYTHON FUNDAMENTALS
ASSIGNMENT-2
a) 31 characters b) 63 characters
a) input(variable) b) input( )
c) Input( ) d) print ( )
a) _a = 1 b) __a = 1
a) my_string_1 b) 1st_string
c) foo d) _
a) eval b) assert
c) nonlocal d) pass
1
8. All keywords in Python are in
a) unlimited length
c) underscore and ampersand are the only two special characters allowed
a) __init__ b) in
c) it d) on
a) global b) 99flag
c) sum d) an$wer
2
14.What is the output of this expression, 3*1**3? (1)3
a) 27 b) 9
c) 3 d) 1
mystring=”hello”
i) 1+2.0+3
4. True or False:
i) Character Data type values should be delimited by using the single quote.
iii) The += operator is used to add the right hand side value to the left hand side variable.
3
6. Identify which of the following expressions are correct:
a) x,y,z=12.5, 170, 'Samarth'
b) x,y,z=12.5, 170, 'Samarth', k
c) x=y=z=100
d) x,y = 10,10, z = 10
e) x,y = 10
7. Observe the following script and enlist all the tokens used in it.
#Identify tokens in the script
name="Fatima"
cl=eval(input("Enter class: "))
print (name,"studies in”, cl,"class")
8. Write a Python script to display the message “Python is interesting”, in different ways.