Grade 11 Revision Worksheet
Grade 11 Revision Worksheet
a = "25"
b=5
c = int(a) + b
print(type(c), c)
x = [1, 2, 3]
y=x
y.append(4)
print(x)
a = (10, 20, 30)
b=a
b += (40,)
print(a)
num = 1
print(num)
16. The following code is intended to print numbers from 1 to 10 but skip 5 using a while
loop. However, there is a logical mistake. Identify and correct it.
num = 1
if num == 5:
continue
print(num)
num += 1
AB
ABC
ABCD
ABCDE
18. Consider the following Python code and predict the output:
print(text[0:6].upper() + text[7:].capitalize())
print(text.endswith("ing"))
print(text.count('p'))
19. Write a Python program that takes a string as input and counts the number of uppercase
and lowercase letters using a loop.
20. Analyze the following Python code and predict its output:
nums = [3, 1, 4, 1, 5, 9]
nums.remove(1)
nums.pop(2)
nums.append(2)
nums.sort()
print(nums)
students = [["Alice", 85, 90, 88], ["Bob", 78, 82, 80], ["Charlie", 92, 88, 95]]
Write a Python program to calculate and print the average marks of each student.
Also find and display the student with the highest average.
22. Consider the following tuple operations and predict the output:
23. Analyze the following two scenarios and explain the difference:
list1 = [1, 2, 3]
tuple1 = (1, 2, 3)
list1.append(4)
tuple1 += (4,)
print(list1)
print(tuple1)
24. Write a Python script to create a dictionary student with following keys:
Edit the dictionary student by incrementing the theo by 2 marks. Display dictionary
student on the screen.
Input value for keys roll, name and theo. Calculate value for keys prac and total.
Display dictionary student on the screen.
hra -floating point (employee house rent allowance = 55% of basic salary)
Input value for keys code, name and basic. Calculate value for keys hra, da, perks and
gross. Display employee dictionary on the screen.
26. Write a Python script to create dictionary employee with following keys:
gsal-floating point (gross salary = basic salary + house rent + dearness allowance)
Input value for keys code, name and bsal. Calculate value for keys hra, da, gsal and bonus.
Display dictionary employee on the screen.
import random
x=[25,55,62,22,99,74]
y=len(x)-2
for i in range(2,y):
n=random.randint(i,5)
print(x[n-1],x[n],end=" ")
a. 99 74 22 99
b. 55 62 62 22
c. 99 25 55 25
d. 74 74 25 99