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

Grade8_IT_Q3_Notes_with_Practice

The document provides notes and practice tasks for Grade 8 IT Q3 assessment, focusing on key programming concepts in Python such as looping statements (for and while loops), accumulators, slicing, and built-in functions. It includes examples and practice tasks to reinforce learning, along with solutions for self-checking. The content is structured to aid students in preparing effectively for their assessment.

Uploaded by

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

Grade8_IT_Q3_Notes_with_Practice

The document provides notes and practice tasks for Grade 8 IT Q3 assessment, focusing on key programming concepts in Python such as looping statements (for and while loops), accumulators, slicing, and built-in functions. It includes examples and practice tasks to reinforce learning, along with solutions for self-checking. The content is structured to aid students in preparing effectively for their assessment.

Uploaded by

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

Grade 8 IT - Q3 Summative Assessment Notes

Grade 8 IT - Q3 Notes with Practice Tasks

These notes will help you prepare for your IT Q3 assessment. Read through the examples carefully,

try the practice tasks, and then check the solutions provided at the end.

1. Looping Statements (For and While Loops)

A loop repeats a block of code multiple times. There are two types of loops in Python: for loops and

while loops.

1. **For Loop**: Used when you know how many times you want to repeat the code.

Example:

for x in range(1, 6):

print("Hello!")

This will print "Hello!" five times.

2. **While Loop**: Used when you want to repeat the code until a certain condition is met.

Example:

count = 1

while count <= 5:

print("Hello!")

count += 1

2. Accumulators

An accumulator is a variable that stores the total of something, like a sum or a product.

Example: Sum of the first 5 numbers

Page 1
Grade 8 IT - Q3 Summative Assessment Notes
s=0

for x in range(1, 6):

s=s+x

print("Sum:", s)

This adds 1 + 2 + 3 + 4 + 5 and prints the total (15).

Example: Product of numbers from 1 to 4

p=1

for x in range(1, 5):

p=p*x

print("Product:", p)

This multiplies 1 * 2 * 3 * 4 and prints the result (24).

3. Slicing

Slicing is used to extract specific parts of a string.

Example: Extract the first 3 letters from "computer"

word = "computer"

print(word[0:3])

This will print "com".

You can also use slicing with a step:

Example: Print every second letter from "computer"

word = "computer"

print(word[0::2])

Page 2
Grade 8 IT - Q3 Summative Assessment Notes
This will print "cmue".

4. Built-In Functions

Python has many built-in functions to help you. Here are some of them:

- input(): Takes user input.

- print(): Displays output.

- int(): Converts a value to an integer.

- len(): Returns the length of a string.

Example:

name = input("What is your name? ")

print("Hello, " + name + "!")

5. Practice Tasks (Write Your Answers Below)

1. Print "I love Python" 10 times using a for loop.

2. Write a program that calculates the sum of the first 10 even numbers.

3. Write a while loop that prints numbers from 1 to 5.

4. Ask the user for a word and print each letter on a new line.

5. Write a program to find the product of numbers from 1 to 5.

6. Solutions

Page 3
Grade 8 IT - Q3 Summative Assessment Notes
1. Solution:

for x in range(10):

print("I love Python")

2. Solution:

s=0

for x in range(2, 21, 2):

s=s+x

print("Sum of the first 10 even numbers:", s)

3. Solution:

count = 1

while count <= 5:

print(count)

count += 1

4. Solution:

word = input("Enter a word: ")

for letter in word:

print(letter)

5. Solution:

p=1

for x in range(1, 6):

p=p*x

Page 4
Grade 8 IT - Q3 Summative Assessment Notes
print("Product of numbers from 1 to 5:", p)

Page 5

You might also like