Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
749 views

Grade 7 - Revision Worksheet-1 On Python Coding

The document contains a revision worksheet with questions on Python coding. It has questions to identify and correct errors in code snippets, extend given code snippets to produce meaningful outputs, predict the output of code snippets, and write Python programs to solve problems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
749 views

Grade 7 - Revision Worksheet-1 On Python Coding

The document contains a revision worksheet with questions on Python coding. It has questions to identify and correct errors in code snippets, extend given code snippets to produce meaningful outputs, predict the output of code snippets, and write Python programs to solve problems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Revision Worksheet - 1

2022 - 2023

Name: Shishir Subject: Computers

Grade: 7 D Topic: Python Coding

Date:

I. List down the errors in the following codes and rewrite the correct code

[a]
A = 10
B = 15
Product = A + B
Print(“The product of two numbers is” product)

It is in capitals

[b]
Soccer_Player_Name = int(input(“Enter Player’s name?”))
Scores = int(input(“Enter total goals”))
print(Soccer_Player)
print(Goals)

II. Extend the following given code to give a meaningful output

[a] This program will find the sum and average of 2 written exams of Amith.
Exam1 = int(input(“Enter the scores of first exam”))
Exam2 = int(input(“Enter the scores of second exam”))
Sum = Exam1+Exam2
Average = Sum/2

[b] This program accepts 3 colors from the user and prints a meaningful
sentence out of 3 colors.
Color1 = input(“Enter the first color”)
Color2 = input(“Enter the second color”)
Revision Worksheet - 1
2022 - 2023

Color3= input(“Enter the third color)”

III. What will be the output of the following codes

[a]
X = 200
Y = 500
Sum = (X * Y ) / 100
print(Sum)

1000

[b]
Flag_1 = int(input(“Enter the distance covered near First flag”))
Flag_2 = int(input(“Enter the distance covered near Second flag”))
Total_Distance_Covered = Flag_1+Flag_2
print(Total_Distance_Covered)

Outputs= sum of inputs

IV. Write python programs for the following questions

1. Ben needs to count the number of marbles in 3 colored boxes he has - Red, Green
and Blue Boxes. Help him write a program that will accept the number of marbles
in each box and find the total number of marbles.

Red=int(input(“Enter the number of marbles in the red box”))


Blue=int(input(“Enter the number of marbles in the blue box”))
Green=int(input(“Enter the number of marbles in the green box”))
Revision Worksheet - 1
2022 - 2023

2. Take a list, say for example this one:


a= [1,1,2,3,5,8,13,23,34,55,89]
and write a program -
a. Add 21 in the 8th position of the list.
b. a.insert(21,7)
c. Add 144 at the end of the list.
d. a.append(144)
e. Remove 23 from the list.
a.remove(23)

3. Create a program that asks the user for a number and then prints out a list of all the
divisors of that number. (If you don’t know what a divisor is, it is a number that
divides evenly into another number. For example, 13 is a divisor of 26 because
26%13 has no remainder.)

Num= int(input(“Enter a number”))


For i in range(0,num+1):
If num%i ==0:
print (i)

You might also like