Part B L5 Introduction to Python Q Ans
Part B L5 Introduction to Python Q Ans
3 What is a variable?
Ans
A Python variable is a reserved memory location to store values
Eg: V=10, here V is variable
1|Page
5
7
9
2|Page
A,B=10,20
A,B=B,A
print(A,B)
Ans 20 10
3|Page
b) Keywords: Keywords are words that have some special meaning or significance in a
programming language. They can’t be used as variable names or function names
c) Expression: an expression is a combination of values, variables, and operators that evaluates to
a single value
d) Tokens: It is the smallest unit of a program
17. Write a program to enter Marks in 5 subjects, Calculate and display total and average
marks
Ans
# Program to calculate total and average marks
m1 = int(input("Enter first subject marks: "))
m2 = int(input("Enter second subject marks: "))
m3 = int(input("Enter third subject marks: "))
m4 = int(input("Enter fourth subject marks: "))
m5 = int(input("Enter fifth subject marks: "))
avg = (m1 + m2+ m3+ m4 + m5) / 5;
print("Average Marks =", avg)
18. Create a list in Python of children selected for Sports with following names
Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik
Perform the following tasks on the list in sequence-
• Print the whole list
• Display the name “Vikram” from the list
• Add the name “Jay” at the end
• Remove the item which is at the second position
Ans
Sports=[ “Arjun”, “Sonakshi”, “Vikram”, “Sandhya”,” Sonal”, “Isha”, “Kartik” ]
print( Sports)
print(Sports[2])
Sports.append(“Jay”)
Sports.pop(2)