WORK SHEET-1
SUBJECT : COMPUTER SCIENCE
LESSON : PYTHON PROGRAMMING TOPIC : INTRODUCTION
NAME :__________________________ CLASS:______________________
LEARNING OBJECTIVE:
1. To recognise variables and datatypes in Python
2. To effectively use input() and print() functions.
I. Which of the following is a valid variable name?
1. 25num
2. Amount_5
3. Print
4. _num
5. School_name
6. minValue
7. total&
II. Correct the error in the following statements
1. print(“Welcome Tom”)
2. print(“Football”
3. print(Dancing)
III. Which of the following four pieces of code has the correct SYNTAX for print()?
1. Print (“Hello world!”)
2. print (“Hello world!”)
3. Print (Hello world!)
4. Print “Hello world!”
IV. Correct the error in the following statements
1. Input(‘Enter your name’)
2. X=input(‘Enter a number’)
3. age=input(int(‘How old are you?’))
Page 1 of 3
V. Find the output of the following code snippet.
No Code Output
1. a=b=c=10
print(a,b,c)
2. name,age,gender=“John”,25,”male”
print(“Name is:”,name)
print(“Age is:”,age)
print(“Gender is:”,gender)
3. a=’35’
b=15
print(type(a))
print(type(b))
print(int(a))
print(float(a))
print(int(a)+b)
print(float(b)+int(a))
4. What would be the output of the
following code if user enters 6 first
and then 3.
x=input(‘Enter a number’))
y=input(‘Enter another number’))
print(‘Sum=’, x+y)
print(‘Sum=’, y+x)
5. What would be the output of the
following code if user enters 2 first
and then 5.
a=int(input(‘Enter a:’))
b=float(input(‘Enter b:’))
print(‘a=’, a)
print(‘b=’, b)
print(‘a+b=’,a+b)
Page 2 of 3