0% found this document useful (0 votes)
3 views

Python_RevisionAssignment

The document is a revision assignment for Grade 8 Information and Communication Technology focusing on Python programming. It contains multiple Python code snippets for students to analyze and write down the expected output, with instructions to indicate 'Syntax Error' if there is a bug. Each code snippet is labeled from (a) to (k) and requires the student to demonstrate their understanding of Python syntax and logic.

Uploaded by

201601002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python_RevisionAssignment

The document is a revision assignment for Grade 8 Information and Communication Technology focusing on Python programming. It contains multiple Python code snippets for students to analyze and write down the expected output, with instructions to indicate 'Syntax Error' if there is a bug. Each code snippet is labeled from (a) to (k) and requires the student to demonstrate their understanding of Python syntax and logic.

Uploaded by

201601002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: ________________________________ ( ) Class: 8____

Grade 8 Information and Communication Technology


Python – Revision Assignment

Write down the output of the following python codes.


(Remarks: “Syntax Error” should be the output if there is a bug in the program.)
(a) x = "Hello"

y = "World"

print(x, y)

print(x+y)
Output:

(b) x = 31

y=3

x = x // y

print (x)
Output:

(c) # a= 8

a=5

a=(a*2)**2 % 4 # a= 5

print(a)

Output:

1
(d) x = 19

y=x-5

y=x/5

print (y)
Output:

(e) p=5

q=3

p=p+q-2

q=p+q-2

p=p-4*5

print(p, q)

Output:

(f) num = 10
text = "Nice"
if num > 5:
if num > 10:
print(num, "is greater than 10")
elif num >=5:
print(text, "You are awesome!")
else:
print("WellDone!")
print(num,"text",text)
Output:

2
(g) x = 15

y = 10

z = 22

if x < 10:

x=y

elif x > 10:

x=z

print(x)
Output:

(h) i = 10

if (i <= 10):

if (i < 15):

print("ABC")

if (i < 10):

print("BCD")

else:

print("CDE")

if (i == 10):

print("ABC")

Output:

3
(i) x = range(1, 7)

for n in x:

print(n)

Output:

(j) x = range(3, 21, 3)


for n in x:
print(n, end="")

Output:

(k) for line in range(3):

for star in range(4,8):

print("*",end="")

print()

Output:

You might also like