0% found this document useful (0 votes)
8 views26 pages

Basic Concepts of Programming - Term3 Exam

The document provides an introduction to computer programming using Scratch and Python, explaining key concepts such as sequence, selection, and iteration. It includes tasks and challenges for creating programs in Scratch, as well as basic rules for using print statements in Python. The document emphasizes the importance of variables and arithmetic operations in programming.

Uploaded by

literallyhuzaifa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views26 pages

Basic Concepts of Programming - Term3 Exam

The document provides an introduction to computer programming using Scratch and Python, explaining key concepts such as sequence, selection, and iteration. It includes tasks and challenges for creating programs in Scratch, as well as basic rules for using print statements in Python. The document emphasizes the importance of variables and arithmetic operations in programming.

Uploaded by

literallyhuzaifa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Computer programming

using Scratch and Python


What is Scratch?
+Scratch is a high level-block based – visual
programming language
Computer program
+A list of instructions that is used to solve a problem
+Three main concepts of programming are:
+Sequence – Running instructions in a order
+Selection – Making choices
+Iteration - Doing the same thing more than once
Identify the ‘sequence’ type of
program.

A B C
Identify the ‘Selection’ type of
program.

A B C
Identify the ‘Iteration’ type of
program.

A B C
Ask and answer

The answer you type will saved in the answer block


Example
Task
1. Create a Scratch program to ask for your favorite
place and display it.
2. Create a Scratch program to ask your mark and
display if it’s a ‘Pass’ or ‘Fail’.
3. Create a program to check if a person is eligible for
the license. If the person’s age is greater 18, he/she is
eligible.
Variables
+It is a container that can store some value.
How to make a variable?
If..else
block
Task

Task 1 (A or B) Task 2
A. Create a scratch 1. Create a Scratch program
program using at least 1 to ask your mark and display
variable. if it’s a ‘Pass’ or ‘Fail’, using
variables.
B. Create the following
2. Create a program to check
scratch program:
if a person is eligible for the
license. If the person’s age is
greater 18, he/she is eligible.
Task 3
+Create a Scratch program to ask for the mark and display
the grade as per the following condition:
+If the mark is greater than 90, display A
+Else, if the mark is greater than 80, display B
+Else, if the mark is greater than 70, display C
+Else, if the mark is greater than 60, display D
+Else, if the mark is greater than 50, display E
+Else, display F
Challenge
+Create a Scratch program to
+Check if a person has passed the driving test (using ask)
+Read the age of the person.
+If the age is more than 8 and has passed the test, display “You
can drive!”, otherwise display “You can’t drive”.
+Selection statements: If, If else
+Iteration statements: forever, repeat
Learning check
+Create a Scratch program to ask for a number. Display
“you win”, if the number is 5, otherwise display “Try
again”.
LO
+To create iteration programs in Scratch
Forever Repeat Repeat until
Task
1. Create a program in Scratch using any iteration statement.
2. Create a program to make the sprite say the numbers from 1 to 10.
3. Create a program to make the sprite say the numbers from 10 to 20.
4. Create a program to make the sprite say the numbers 1,3,5,7…till 15.
5. Create a program to make the sprite say the numbers 2,4,6,8…till 20.
6. Create a program to make the sprite say the numbers 10,20,30…till
100.
Challenge:
A. Create a ‘Guess the number’ game using Scratch.
B. Create a program to make the sprite say the numbers 100,90,80….10.
Extended Task:
Create a story/game in scratch using selection and iteration statements.
Introduction to Python
Python
+It is a high-level text-based programming language.
+We use Python IDLE editor to do programs in Python.
+.
Arithmetic operators in Python
LO: To create simple programs in
Python
+Arithmetic operators are used to perform math
operations in Python.
Rules to follow while using print in
Python.
print() is used to display in Python.
 While displaying any text, it should be within a double quotation; otherwise, Python
gives an error message.
Example:
print(“Hi”) this statement prints Hi.
print(Hi)  this statement prints error message.
 While displaying a number, it should not be within double quotation, otherwise, it
will print the statement as such.
Example:
print(1+2) this statement prints 3
print(“1+2”)  this statement prints 1+2
See the following examples:
+ print(“ICT”)  ICT
+ print(ICT)  Error (Why? ICT should within double quotation””. The correct way is print(“ICT”))
+ Print(“ICT”)  Error (Why? Letter p in ‘Print’ should be small case. The correct way is print(“ICT”))
+ print(100+200)  300(Why? For numbers, we should not use double quotation””.)
Predict Output
1. print(30+20)
2. print(3*4)
3. Print(5+2)
4. print(5+2)
5. print(“Python”)
6. print(“Programming”)
7. print(Python)
8. print(“6+7”)
9. print(“10/5”)
10. print(6+7)
Predict Output - Answers
1. print(30+20) - 50
2. print(3*4) - 12
3. Print(5+2) –Error(Letter p should be small)
4. print(5+2) - 7
5. print(“Python”) - Python
6. print(“Programming”) - Programming
7. print(Python) – Error (No double quotation)
8. print(“6+7”) – 6+7(As numbers in double quotation)
9. print(“10/5”) – 10/5(As numbers in double quotation)
10. print(6+7) - 13

You might also like