Revision Worksheet Python-3
Revision Worksheet Python-3
Introduction to Python
1-5) In the question(s) given below, there are two statements marked as Assertion (A)
and Reason (R). Read the statements and choose the correct answer from the options
given below.
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is true, but R is false.
d) A is false, but R is true.
e) Both A and R are false.
1. Assertion (A): One of the key aspects of python is that it uses the concept of
classes and objects.
Reason (R): Python is open source which means anyone can contribute to the
language.
2. Assertion (A): A list can also be initialized with same values being assigned to all
the elements.
Reason (R): For assigning the same values in all elements of a list, we use * as a
replication operator.
3. Assertion (A): The comparison operator returns either True or False according to
the condition.
Reason (R): The == Operator returns False if both operands are equal.
4. Assertion (A):
X=5
Y=”Six”
print(X+Y)
the above program will give an error when executed.
Reason (R): The data type number and String are incompatible.
5. Assertion (A): Comments are the executable statements in a Python program.
Reason (R): To give a Single line comment we use #.
6. Write the methods used for performing the following task.
a. To add a new element in a list at last
b. To remove an element from a particular index.
c. To reverse all the elements of a list.
d. To clear all elements from the list.
e. To find out the index value of a particular element occurred for first time.
7. Python is most preferred language for AI. Justify the statement.
8. Study the following programs and find the errors. Rewrite the program and
underline the corrections done.
a. n1=input(“Enter first number:”)
n2=input(“Enter second number:”)
add=n1+n2
print(“The total is:”, add)
b. list1={5,4,3,2,1}
list1.sort()
print(“The List is:”,list1)
c. list1=[“Red”, “Blue”, “Green”]
list1.append(“White”, “Pink”)
print(“The List is:”,list1)
d. list1=[“Red”, “Blue”, “Green”]
list1=[“White”, “Pink”,”Black”]
print(“The List is:”,list2)
9. Vivan is a beginner for Python, he wants to create a program in Python. Suggest
him in which mode he has to create a program in Python.
10. Parth has a collection of brand of cars which he wants to store them at one place
through Python program so that whenever required these can be accessed.
Suggest him how to do this task, also give an example to do this.