Revisit phase - Starter
Boolean expression | True/False |
4 > 5 AND 7 == 7 | |
NOT(2 == 2) | |
11 <= 2 OR 4 != 1 | |
NOT(12 > 2 OR 5 < 1) | |
5 != 5 AND 7 > 2 | |
10 >= 10 and 5<=6 | |
False
False
True
False
False
True
Created by Mr Suffar
String Manipulation
Lesson 6
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
Video
Lesson theory video: https://youtu.be/gEJMBkArksg
Created by Mr Suffar
String manipulation - Concatenation
Concatenation means ‘joining’.
The ‘+’ sign joins together two or more string (without a space).
firstname = input("Enter your firstname")
surname = input("Enter your surname")
print(firstname+surname)
Created by Mr Suffar
String manipulation - Concatenation
firstname = input("Enter your firstname")
surname = input("Enter your surname")
print(firstname+" "+surname)
What will the following program display if the user enters “Barry” as the firstname and “Wood” as the surname?
Created by Mr Suffar
String manipulation - Concatenation
You can also use the “,” to join 2 strings together WITH A SPACE. However, in the exam if they ask you to concatenate, you MUST use the “+” sign to join strings together.
firstname = input("Enter your firstname")
surname = input("Enter your surname")
print(firstname, surname)
Created by Mr Suffar
Using concatenation
firstname = input("Enter your firstname")
surname = input(firstname, " Enter your surname")
The above code will give you an error, because you can’t add a comma when storing a value in a variable because it will count it as an argument. However you can concatenate using “+” sign.
Created by Mr Suffar
Correct way:
firstname = input("Enter your firstname")
surname = input("hey " +firstname+" Enter your surname")
Created by Mr Suffar
String manipulation - Length
len() is a python function that finds the length of a string.
Example 1:
name = "Riley"
print( len (name) )
The above program will diplay the number 5. Because that is the number of characters is in the string "Riley"
Created by Mr Suffar
String manipulation - Length
len() is a python function that finds the length of a string.
Example 2:
name = input("Enter a name")
print( len (name) )
The above program will diplay the number 4 if the user types Jeff as the name.
Created by Mr Suffar
String manipulation - Length
What will the program below display?
Created by Mr Suffar
String manipulation - Length
What will the program below display if the user enters Tennis?
Created by Mr Suffar
Tasks
Complete the tasks
Created by Mr Suffar
148. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
name = input("Enter a name")
hobby=input("Enter hobby")
total = name+hobby
print(len(total))
Answer:
Created by Mr Suffar
149. The program below must: Ask the user for a film that contains 3 characters and then display whether the user is correct or incorrect.
Copy the code below, run it and fix the errors.
film = input(Enter a film that 3 characters")
if length(film)==3
print"Correct")
else:
print=("Incorrect")
Paste the correct version below:
Created by Mr Suffar
150. Create a program that:
Asks the user for a sentence.
If the sentence contains more than 20 characters including space, display “Too long”
Otherwise display “Just right”
sentence = _____("Enter a sentence")
if len(_____) >20:
_____("Too long")
_____:
_____("Just right")
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
151. Create a program that:
Paste your code below:
Created by Mr Suffar
152. Create a program that:
Paste your code below:
Created by Mr Suffar
153. Create a program that:
Paste your code below:
Created by Mr Suffar
154. Create a program that:
Hint: len(colour)
Paste your code below:
Created by Mr Suffar
String manipulation – Case conversion
You can turn your string to either uppercase using .upper() or lowercase using .lower()
name = input("Enter your name")
print ( name.upper() )
print ( name.lower() )
Created by Mr Suffar
String manipulation – Case conversion
What will the following code display if the user enters “Football”.
Created by Mr Suffar
String manipulation – Case conversion
What will the following code display if the user enters “FoOtBaLL”.
Created by Mr Suffar
String manipulation – Substring
Substrings are used to extract part of a string.
Index numbers starts from 0.
What do you think the following code will display?
country = "ENGLAND"
print(country[0])
It will display the letter “E”
Index number | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
Characters | E | N | G | L | A | N | D |
Created by Mr Suffar
String manipulation – Substring
Substrings are used to extract part of a string.
Index numbers starts from 0.
What do you think the following code will display?
country = "France"
print(country[1])
It will display the letter “r”
Created by Mr Suffar
String manipulation – Substring
What do you think the following code will display?
country = "Italy"
print(country[len(country)-1]
It will display the letter “y”
len(country)-1 will allow you to display the last letter of the string. This is because len(country) will give you 5, and 5-1 = 4 and country[4] = “y”
Created by Mr Suffar
String manipulation – Substring
What do you think the following code will display?
country = "Egypt"
print(country[len(country)]
The program will crash as len(country) is 5 and there are no index 5 in the string as we start from 0.
Created by Mr Suffar
String manipulation – Substring
What do you think the following code will display?
country = “Jordan"
print(country[len(country)-2]
It will display the letter “a”
Created by Mr Suffar
String manipulation – Substring
What do you think the following code will display?
country = "Malta"
print(country[len(country)-1]
It will display the letter “a”
Created by Mr Suffar
String manipulation – Substring – PYTHON
The following code will display: “EN”
country = "ENGLAND"
print( country [ 0 : 2 ] )
Start position
Up to but not included
Index number | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
Characters | E | N | G | L | A | N | D |
Created by Mr Suffar
String manipulation – Substring – PYTHON
The following code will display: “AND”
country = "ENGLAND"
print( country [ 4 : ] )
Start position
If you leave it empty, it will go to the end of the string
Index number | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
Characters | E | N | G | L | A | N | D |
Created by Mr Suffar
String manipulation – Substring – PYTHON
What will the following code display?
country = "United States"
print( country[1: 6 ])
Start position
Up to but not including
It will display “nited”
Index number | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Character | U | n | i | t | e | d | | S | t | a | t | e | s |
Created by Mr Suffar
String manipulation – Substring – PYTHON
What will the following code display?
country = "United States"
print( country[7 : ])
It will display “States”
Created by Mr Suffar
Tasks
Complete the tasks
Created by Mr Suffar
155. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
hobby = input("Enter a hobby")
choice = input("Do you want the first letter in Uppercase or lowercase?")
if choice == "upper":
print(hobby[0].upper())
else:
print(hobby[0].lower())
Answer:
Created by Mr Suffar
156. The program below must: Ask the user for a favourite car, then displays “German” if the user enters BMW. It displays Japan if the user enters Toyota. It displays the first letter of the car for any other choice.
Copy the code below, run it and fix the errors.
car input("Enter your favourite car")
if car.upper() == "BMW"
print"German")
elif car.lower == "toyota":
print("Japan")
else
print("The first letter of your favourite car is",car[1])
Paste the correct version below:
Created by Mr Suffar
157. Create a program that:
Asks the user to enter a city name that contains 5 letters. If the user gets it right, display “Correct” then display the first letter of the city. Otherwise display “Incorrect” and the last letter of the city.
city = ____("Name a city that contains 5 letters")
if len(____) == 5:
____("Correct")
print(city[__])
____:
print("Incorrect")
print(city[len(____)-1])
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
158. Create a program that:
Paste your code below:
Created by Mr Suffar
159. Create a program that:
Paste your code below:
Created by Mr Suffar
160. Create a program that:
Paste your code below:
Created by Mr Suffar
161. Create a program that:
Paste your code below:
Created by Mr Suffar
162. Create a program that:
Paste your code below:
Created by Mr Suffar
163. Create a program that:
Hint: len(animal)
Paste your code below:
Created by Mr Suffar
164. Create a program that:
Paste your code below:
Created by Mr Suffar
Formatting text
\n - This adds a new line. Example:
print("Hello \nWorld") would display:
\t - The t stands for “tab” which adds extra space. Example:
print("Hello \tWorld") would display:
Created by Mr Suffar
165) Create a program that:
Paste your code below:
Created by Mr Suffar
166. Create a program that:
Paste your code below:
Created by Mr Suffar
167. Create a program that:
Paste your code below:
Created by Mr Suffar
168. Create a program that:
Paste your code below:
Created by Mr Suffar
169. Create a program that:
Paste your code below:
Created by Mr Suffar
170. Create a program that:
Paste your code below:
Created by Mr Suffar
171. Create a program that:
Paste your code below:
Created by Mr Suffar
172. In a school, a student username is created by extracting first 2 letters of firstname, first 3 letters of surname, last 2 numbers of the year and it adds a hashtag depending on the number of other students with the same surname. For example: if a student named Bob Liam joined in 2023 and there are 2 other people in the school with the surname Liam, then the username of this student is: “BoLia23##”
Paste your code below:
Created by Mr Suffar
TASK 173
Answer:
Created by Mr Suffar
Task 174
Answer:
Created by Mr Suffar
175. A car registration code needs to be entered before a car can be registered. The registration code must start with a capital letter and must be followed by a number between 0 and 9.
Create a program that:
Asks the user to enter the registration code.
Checks and displays whether the code is valid or invalid.
Paste your code below:
Created by Mr Suffar
Created by Mr Suffar
Revisit phase - Starter
Used to … | Function / symbol |
Change the string to lowercase | .lower() |
Change the string to uppercase | |
Symbol used to concatenate 2 strings. | |
Finds the length of a string | |
Which brackets are used to extract part of a string | |
.upper()
+
len()
[]
Created by Mr Suffar
Iteration
Lesson 7
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
Created by Mr Suffar
Knowledge phase�
Iteration: The repetition of a process/ section of code.
Created by Mr Suffar
for __ in range(__) :
code to be run here
more code to be run here
this code not in the for loop
Note that indenting (using the TAB key) is used to decide which code goes inside the loop.
Variable
Number of iteration
End with a colon
Structure of a for loop
Created by Mr Suffar
for x in range (5) :
print("Hello")
print("The end")
It will display “hello” 5 times then it will display “The end” ONCE.
Variable
Number of iteration
Created by Mr Suffar
for y in range (3) :
name=input("Enter a name")
print("Your name is", name)
print(“Good bye")
It will ask the question 3 times and then displays the names 3 times then it will display “Good bye” once
Variable
Number of iteration
Created by Mr Suffar
number = int(input("Enter number"))
for i in range (number) :
print("hello")
This will display “hello” depending on the number that the user entered.
Created by Mr Suffar
Tasks
Complete the tasks
Created by Mr Suffar
176. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
for x in range(10):
print("Computer Science")
print("Is the best")
Answer:
Created by Mr Suffar
177. The program below must: Ask the user for 5 football team names, then displays “You have now entered 5 teams when all 5 teams have been entered.
Copy the code below, run it and fix the errors.
for x in range(5)
team = input("Enter a football team"
print(The team you have entered is:"team)
prints("You have now entered 5 teams")
Paste the correct version below:
Created by Mr Suffar
178. Create a program that:
Asks the user to enter 5 numbers, for each number, if the number is odd, display the number followed by “is odd”. If the number is even, display the number followed by “is even”.
for ___ in ____(5):
num = ___(___("Enter a number"))
if num % ___ == 0:
print(___,"is even")
else:
print(num,"___")
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
179.
for count in range(1,31):
print (count * "%")
Paste your new code below with comments:
Created by Mr Suffar
180. Use a for loop to display “welcome” 100 times. Then display “bye” ONCE.
Paste your code below:
Created by Mr Suffar
181. Ask the user for a number. Repeat ‘I like turtles’ a certain number of times, based on a number entered by the user. (If the user enters 5, display I like turtles 5 times)
Paste your code below:
Created by Mr Suffar
182. Ask the user to enter a name. Ask the user how many times they want their name to be displayed. Display the user’s name repeatedly depending on the user’s answer.
Paste your code below:
Created by Mr Suffar
183) Ask the user their name and their age. Print their name the number of times as their age.
Paste your code below:
Created by Mr Suffar
184) Write a program that:
Paste your code below:
Created by Mr Suffar
185. Create a program that:
Paste your code below:
Created by Mr Suffar
186. Create a program that asks the user for their name and then display it 10 times.
Paste your code below:
Created by Mr Suffar
187. Use a for loop to display “Hello World” 100 times. Then display “bye” ONCE.
Paste your code below:
Created by Mr Suffar
188) Create a program that:
Paste your code below:
Created by Mr Suffar
189) Wzzap market is a shop that sells face masks.
Create a program that:
Paste your code below:
Created by Mr Suffar
190) Create a program that:
Paste your code below:
Created by Mr Suffar
191) Create a program that:
Asks if McDonald’s is open. If the user answers “yes”, ask the user to enter how much their meal will cost.
IF their meal costs more than 5, display “no McDonald’s today” 5 times. Else display “I can buy this meal” 5 times.
Otherwise, display “McDonald’s is closed” 5 times.
Paste your code below:
Created by Mr Suffar
192. Ask the user for a number. Then ask the user what their favourite subject is.
Display a full sentence which shows the user’s favourite subject. R
Paste your code below:
Created by Mr Suffar
193. Ask the user to enter a name. If the name contains 5 or more characters, display the first letter of the name 10 times. Otherwise display the last letter of the name once.
Paste your code below:
Created by Mr Suffar
194. Ask the user to enter their firstname and store it in a variable called “firstname”. Then ask them to enter their surname and store it in a separate variable. Create a variable called fullname and use concatenation to join the 2 strings together. Now display the total amount of characters in the fullname 5 times. Then display the full name without a space in capital letters.
Paste your code below:
Created by Mr Suffar
for x in range (1,11) :
print(x)
This is used if you want to use a counter. x is a variable that will hold numbers from 1 to 10.
Variable
Start from
Up to but not included
Created by Mr Suffar
for count in range (1,6) :
print(count* 10)
This will produce the 10 times table from 1 to 5.
Variable
Start from
Up to but not included
Created by Mr Suffar
number = int ( input ( "Enter number " ) )
for count in range (1,6) :
print ( number * count )
What will the above program display if the user enters 100 as the number.
Created by Mr Suffar
num = 7
for x in range(1,6):
print(x,"*",num,"=",x*num)
The above program will display the times table of 7 from 1 to 5.
String
Created by Mr Suffar
Time.sleep function
Time.sleep function is used to add delay in the execution of a program.
import time
num = int(input("Enter a number"))
for x in range(1,11):
print(x,"*",num,"=",x*num)
time.sleep(1)
Delay in seconds
Allows you to use the
time.sleep function
Created by Mr Suffar
Tasks
Complete the tasks
Created by Mr Suffar
195. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
import time
num = int(input("Enter a number"))
for x in range(1,101):
print(num,"/",x,"=",num/x)
time.sleep(0.5)
Answer:
Created by Mr Suffar
196. The program below must: Count from 1 to 100. For each number, display the number followed by “is divisible by 4” if it is divisible by 4. and “is not divisible by 4” if it is not divisible by 4.
Copy the code below, run it and fix the errors.
import timeeee
for x in range(1,10001):
if x % 4 == 0
print(y,"is divisible by 4")
time.sleep(21)
else
print(x,"is not divisible by 4")
time.sleep(1)
Paste the correct version below:
Created by Mr Suffar
197. Create a program that:
Counts from 1 to 100. For each number, display each number and then display Blue if the number is odd, display “Red” if the number is even.
import ____
for x in ____(1,101):
print(____)
if __ % 2 == 0:
____("Red")
else:
print("____")
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
198. Create a program that counts from 1 to 100.
Paste your code below:
Created by Mr Suffar
199. Ask the user for a number. Display the times table of that number from 1 to 100.
Paste your code below:
Created by Mr Suffar
200. Ask the user for a number. Display the times table of that number from 1 to 5 in the following style 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪
Paste your code below:
Created by Mr Suffar
201) Create a program that:
Paste your code below:
Created by Mr Suffar
202) Create a program that:
Paste your code below:
Created by Mr Suffar
203. Create a program that counts and displays all numbers from 15 to 25.
Paste your code below:
Created by Mr Suffar
204. Ask the user for a number. Display the powers of 0 to 10 for that number.
HINT: ** = the exponent operator
Paste your code below:
Created by Mr Suffar
205. Print the numbers from 1 to 100, but replace multiples of 3 with “Chicken" and multiples of 5 with “Nuggets".
Paste your code below:
Created by Mr Suffar
206. Create a program that:
Prints the numbers from 1 to 100, but replace multiples of 3 with "Fizz" and multiples of 5 with "Buzz". If a number is both a multiple of 3 and 5, it will be replaced with "FizzBuzz".
Paste your code below:
Created by Mr Suffar
207. Ask the user for a number. Divide that number from 1 to 5 and display the answer in a full sentence. 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪 🡪
Paste your code below:
Created by Mr Suffar
208. Create a program that takes a number that is greater than 0 and less than 100 as an input.
Paste your code below:
Created by Mr Suffar
Task 209
Python
Answer:
Created by Mr Suffar
Homework: https://youtu.be/LDjUhj7yvkQ
Watch the video above then complete the kahoot on for loops:
https://create.kahoot.it/share/for-loops-homework-part-1/d4f80436-cedf-4fe5-b432-d522492e889e
Created by Mr Suffar
for count in range (1,6) :
print(count* 10)
This will produce the times table of 10 from 1 to 5.
Variable
Start from
Up to but not included
What will the following code display?
Revisit phase - Starter
Created by Mr Suffar
for count in range (1,101) :
print(count* 3)
Variable
Start from
Up to but not included
Revisit phase - Starter
What will the following code display?
Created by Mr Suffar
Totalling, Counting, Highest & Lowest
Lesson 8
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
total = 0
for x in range(10):
num = int(input("Enter a number"))
total = total+num
The above program will calculate the total (sum) of 10 numbers.
Set total to 0
Number of iteration
Ask for a number
Adds the number to
The total variable.
Created by Mr Suffar
count = 0
for x in range(10):
num = int(input("Enter a number"))
if num>100:
count=count+1
The above program will count how many of the 10 numbers entered are above 100.
Set count to 0
Number of iteration
Ask for a number
Checks if the number is
bigger than 100
Increment count by 1
Created by Mr Suffar
#Ask for 10 numbers, calculate highest and lowest number
highest = 0
lowest=9999999
for x in range(10):
num = int(input("Enter a number"))
if num > highest:
highest = num
if num < lowest:
lowest = num
Checks if the number entered
Is bigger than highest.
Set highest to that number.
Checks if the number entered
Is smaller than lowest.
Set lowest to that number.
Created by Mr Suffar
Assignment
In python, a single “=“ sign indicates an assignment statement.
In this assignment statement, we are assigning the value 5 to the variable number.
In pseudocode, the arrow 🡨 is used to indicate an assignment statement.
Created by Mr Suffar
COLD CALL
Created by Mr Suffar
COLD CALL
Created by Mr Suffar
COLD CALL
Created by Mr Suffar
Tasks
Complete the tasks
Created by Mr Suffar
210. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
total = 0
for x in range(10):
num = int(input("Enter a number"))
if num % 2 == 0:
total = total + num
print("Sum of even numbers:", total)
Answer:
Created by Mr Suffar
211. The program below must: Display all numbers from 1 to 10 inclusive. Adds each number to a total then displays the total at the end.
Copy the code below, run it and fix the errors.
total = 5
for num1 in range(1, 115)
print(num
total = num + total1
print("Sum of numbers:" total)
Paste the correct version below:
Created by Mr Suffar
212. The program below must: Asks the user to enter 10 numbers, counts how many numbers entered are above 1000. Display the answer at the end.
Copy the code below, run it and fix the errors.
count = 4
for i in range(10:
num = int(input("Enter a number: ")
if num == 1000:
count = count - 1
print("The number of numbers above 1000 is:" count)
Paste the correct version below:
Created by Mr Suffar
213. Create a program that: Asks the user for 5 numbers, calculates and displays the highest and lowest number
highest = ____
lowest=____
for x in range(___):
num = ___(___("Enter a number"))
if num > ___:
___ = num
if num < ___:
lowest = ___
print("Highest:",___)
print("Lowest:",___)
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
214. In python,
Paste your code below:
Created by Mr Suffar
215. In python,
Paste your code below:
Created by Mr Suffar
216. In python
Paste your code below:
Created by Mr Suffar
217. In python:
Paste your code below:
Created by Mr Suffar
218. A teacher is recording the amount of time it take to solve a Rubik cube. The algorithm must:
Paste your code below:
Created by Mr Suffar
219. A teacher wants to count the number of students who play games for at least 10 hours a week.
Create an python program that:
Ask 5 students for the number of hours a week they spend playing games.
Count and display the number of students who play games for at least 10 hours a week.
Paste your code below:
Created by Mr Suffar
220. Ask the user to enter 10 numbers.
Count and display how many of the numbers entered are between 10 and 99.
Paste your code below:
Created by Mr Suffar
221. Create a program to calculate how many points a player has after 5 games. Players receive 3 points for winning, 1 point for a draw and 0 points for losing a game. The player will move up to a higher division if they achieve at least 12 points. The player will move to a lower division if they achieve a less than 6 points. Otherwise they will stay in the same division. Your program must:
Paste your code below:
Created by Mr Suffar
222. Create a program that:
Paste your code below:
Created by Mr Suffar
223. Dodgy Sam visited 6 supermarkets in 1 day to stock pile toilet rolls.
Create an algorithm that:
Hint: Use for a for loop and if statements.
Paste your code below:
Created by Mr Suffar
224. A hospital wants to create a survey to check how many patients are carrying a virus. If the patient has a fever AND a dry cough, the hospital assumes they test positive for the virus.
Create a program that:
Paste your code below:
Created by Mr Suffar
Task 225
Answer:
Created by Mr Suffar
Task 226
Answer:
Created by Mr Suffar
227. In python, create a program that:
Paste your code below:
Created by Mr Suffar
228. A class has 4 students.
Create a program that asks 4 students for their name and their height in CM
Calculate and display the average height of the class.
Calculate and display the name and the height of the tallest person in the class.
Calculate and display the name and the height of the shortest student in the class.
Paste your code below:
Created by Mr Suffar
Homework
Created by Mr Suffar
Nested for loop & Trace table
Lesson 9
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
Theory: https://youtu.be/LDjUhj7yvkQ
Created by Mr Suffar
Trace table
Trace table is used to:
Created by Mr Suffar
Example of a simple trace table:
x | Output |
| |
| |
| |
| |
| |
for x in range (1,6):
print(x*2)
1
2
2
4
3
6
4
8
5
10
Created by Mr Suffar
Example of a trace table:
x | x < 3 | Output |
| | |
| | |
| | |
| | |
for x in range (1,5):
if x < 3:
print("less than 3")
else:
print("3 or above")
1
True
Less than 3
2
True
Less than 3
3
False
3 or above
4
False
3 or above
Created by Mr Suffar
Assume the user enters the following values: “Sam”, “upper”, “Ayo”, “lower”, “Zoe”,”upper”
x | choice | case | Output |
| | | |
| | | |
| | | |
for x in range(1,4):
choice = input("Enter a word")
case = input("upper or lower")
if case == "upper":
print(choice.upper () )
else:
print(choice.lower () )
1
Sam
upper
SAM
2
Ayo
lower
ayo
3
Zoe
upper
ZOE
Created by Mr Suffar
Tasks
Complete task
Created by Mr Suffar
229. Complete the trace table.
X | Output |
| |
| |
| |
| |
| |
for x in range (1,6):
print(x**2)
Created by Mr Suffar
230. Complete the trace table.
for x in range (1,5):
country = "France"
print(country[x])
X | country | Output |
| | |
| | |
| | |
| | |
Created by Mr Suffar
231.Assume the user enters the following values: 0, 3, 2, 5
for x in range (2,7):
if x < 3:
print("it’s Jeff")
else:
num = int(input("Enter a number"))
print(x * num)
x | Is x < 3 | num | Output |
| | | |
| | | |
| | | |
| | | |
| | | |
Created by Mr Suffar
232. Assume the user enters the following values: “Nick”, “Lukas”, “Lara”, “Tim”
for x in range (1,5):
name= input("Enter a name")
length = len(name)
print(x * length)
X | name | length | Output |
| | | |
| | | |
| | | |
| | | |
Created by Mr Suffar
233. Assume the user enters the following values: 7, 0, 4, 8
for x in range (1,5):
country = "United States"
num = int(input("Enter a number"))
letter = country[num]
print(country[x] + letter)
X | country | num | letter | Output |
| | | | |
| | | | |
| | | | |
| | | | |
Created by Mr Suffar
234. Assume the user enters the following values: 4, *, 3, % ,6, %, 5, *
Hint: % = MOD (finding the remainder)
for x in range (1,5):
num = int(input("Enter a number"))
operator = input("Enter operator")
if operator == "%":
print(num % x)
else:
print(num*x)
x | num | operator | Output |
| | | |
| | | |
| | | |
| | | |
Created by Mr Suffar
235. Complete the trace table.
for x in range (1,7):
if x % 2 == 0:
print(x)
X | Is x % 2 == 0 | Output |
| | |
| | |
| | |
| | |
| | |
| | |
Created by Mr Suffar
236. Complete the trace table
for x in range (1,4):
for y in range (1,4):
print( x * y )
x | y | Output |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
Created by Mr Suffar
for x in range(1,6):
for y in range(1,11):
print(x,"X",y,"=",x*y)
The above program will calculate the total (sum) of 10 numbers.
Repeats 5 times
Repeats 10 times for every x, in this case this
line will be executed 50 times.
Displays the times table of 1 to 5
from 1 to 10.
A nested for loop is a for loop inside another for loop
Created by Mr Suffar
FOR loop with different steps
You can change the number that each loop increments by.
for x in range(1, 101, 2) :
print(x)
This will for loop will start from 1 and increments by 2 until it reaches 100.
Created by Mr Suffar
FOR loop with different steps
You can also count down:
for y in range(100,0,-1) :
print(y)
This will count from 100 down to 1. The last number is not inclusive.
Created by Mr Suffar
237. Create a nested loop (for loop inside a for loop) to display the multiplication timetable between 1 and 5. Display your answer in an appropriate format. Example:
Paste your code below:
Created by Mr Suffar
238. Create a program that counts down from 1000 to 1.
Paste your code below:
Created by Mr Suffar
239. Create a program that counts up in steps of 3 from 1 to 1000.
Paste your code below:
Created by Mr Suffar
240. Code the following flowchart in python:
Paste your code below:
Created by Mr Suffar
241. Code the following flowchart in python:
Paste your code below:
Created by Mr Suffar
Homework: https://youtu.be/gn6RIuipDBw
https://create.kahoot.it/share/nested-for-loop-homework/be8e1977-9b61-4fdc-87d8-162225d52569
Created by Mr Suffar
Looping through string & ASCII characters
Lesson 10
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
name = "Max"
print(name[0])
print(name[1])
print(name[2])
print(len(name))
What will the above program display?
Looping through a string
Created by Mr Suffar
name = "Max"
for x in range(0,3):
print(name[x])
What will the above program display?
Looping through a string
Created by Mr Suffar
name = "Max"
for x in range(0,len(name)):
print(name[x])
What will the above program display?
Looping through a string
Created by Mr Suffar
phonenum = input("Enter a phone number")
for x in range(0,len(phonenum)):
print(phonenum[x])
Loops through the string
Displays every number in
the string on a separate line
Looping through a string
Created by Mr Suffar
nine = 0
phonenum = input("Enter a phone number")
for x in range(0,len(phonenum)):
if phonenum[x] == "9":
nine = nine+1
print("There are",nine,"nines in the phone number")
The above program will count and display the number of 9s in the phone number.
Looping through a string
Created by Mr Suffar
lowercase = ""
sentence = input("Enter a sentence")
for x in range(0,len(sentence)):
if sentence[x] == sentence[x].lower():
lowercase = lowercase + sentence[x]
print(lowercase)
The above program asks the user for a sentence, and then adds all the lowercase characters to a variable called lowercase and displays it on the screen.
Created by Mr Suffar
242. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
sentence = input("Enter a sentence")
newsentence = ""
for x in range(len(sentence)):
if sentence[x].lower() == "s":
newsentence = newsentence+ "#"
elif sentence[x].lower() == "a":
newsentence = newsentence+ "@"
else:
newsentence = newsentence+ sentence[x]
print(newsentence)
Answer:
Created by Mr Suffar
243. The program below must: Ask the user for a 4 digit pin code that doesn’t have the number 0. If the length of the digit is not 4, display “Not a 4 digit pin”, otherwise, check if the code includes the number 0, if it does, display invalid, if it doesn’t have a 0, display valid.
Copy the code below, run it and fix the errors.
pin = input("Enter a 4 digit pincode without the number 0)
valid = Truee
if len(pin) == 4
for x in range(length(pin)):
if pin[y] == "0":
valid= False
printvalid)
else
print("Not a 4 digit code"
Paste the correct version below:
Created by Mr Suffar
244. Create a program that: Asks the user for a name. Count and display how many letters between “a” to “g” inclusive is in the name.
name = ____("Enter a name")
count = __
for x in range(len(____)):
letter = ____[x].lower()
if letter >= "a" and ____ <= "g":
count = ____+__
print("Number of letters between a-g in the name:",____)
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
245. Create a program that:
Paste your code below:
Created by Mr Suffar
246. Create a program that:
Paste your code below:
Created by Mr Suffar
247. Create a program that:
Paste your code below:
Created by Mr Suffar
248. Create a program that asks the user for their name and then display the name with each character repeated once.
For example: if the user enters Max, it displays Mmaaxx.
Paste your code below:
Created by Mr Suffar
249. Create a program that ask the user to enter a sentence, then display only the uppercase characters in that sentence.
Paste your code below:
Created by Mr Suffar
250. Ask the user to enter their school name. Then capitalise the last letter of the school name and display the answer on the screen.
Paste your code below:
Created by Mr Suffar
251. Create a program that:
Paste your code below:
Created by Mr Suffar
252. Create a program that asks the user for a sentence. Then reverse the case. All lower-cased letters should be upper-cased, and vice versa. Display your answer on the screen.
Paste your code below:
Created by Mr Suffar
253. Create a program that:
Paste your code below:
Created by Mr Suffar
254. Palindromes is a word, phrase, or sequence that reads the same backwards as forwards, e.g. madam , bob.
Create a program that:
Paste your code below:
Created by Mr Suffar
255. Parity bits are used to ensure binary data are not corrupted during transit. They work by calculating the number of 1s in a binary number. If the binary number contains an even number of 1s, it means an even parity was used. If the number of 1s are odd, it means it uses odd parity.
Create a program that:
Paste your code below:
Created by Mr Suffar
256. Create a program that asks the user to enter a sentence then count the number of words in that sentence and displays it on the screen.
Paste your code below:
Created by Mr Suffar
257. Create a program that asks the user for a sentence then turns any letter “s” or letter “x” into a capital letter then display the answer on the screen.
Paste your code below:
Created by Mr Suffar
258. Create an encryption algorithm (program) that encrypts a sentence.
Your program must ask the user for a sentence then encrypt the sentence by changing the letters (a and n to “#”) and the letters (m, t to “&”) and (g, s to “@”).
Paste your code below:
Created by Mr Suffar
259. Create a program that:
Paste your code below:
Created by Mr Suffar
ord() is a function that returns the ascii code for the character.
Example: ASCII code for ‘A’ is 65, ‘a’ is 97, etc.
Example: ord("a") is 97
chr() is the opposite of ord()
chr() is a function - it gives the corresponding character for given ASCII code. For example, to find the letter of the ASCII code 97 we write:
chr(97) which is ‘a’
Created by Mr Suffar
260. Create a program that displays the ascii code for the letter “C” and then displays the character for the ascii code 98.
Paste your code below:
Created by Mr Suffar
261. Create a program that:
Paste your code below:
Created by Mr Suffar
262. Ask user for name, convert each letter to character code then add the number (code) to a total and display the total.
Paste your code below:
Created by Mr Suffar
263. Ask user for name, convert each letter to a character code then add 1 to that number and convert the code back to a character and store it in a new string. If the letter is “z”, you need to convert it to the letter a. If the letter is b convert it to a c and so on. Now display the new name.
Paste your code below:
Created by Mr Suffar
264. Create a program that asks the user to enter a number from 5 to 30. If the user enters a number outside this range, display “invalid number entered”
If the user enters a number in the correct range, add 60 to that number, then convert it to ASCII character code using chr() and display it on the screen.
Paste your code below:
Created by Mr Suffar
Homework: https://youtu.be/gn6RIuipDBw
Complete the Kahoot
https://create.kahoot.it/share/looping-through-string-homework/409f2307-a0c2-4fec-b5ee-cdabc3ceff36
Created by Mr Suffar
Revisit phase – COLD CALL
Identify the syntax and Logic errors in the code above:
Syntax: missing colon
Syntax: missing parenthesis
Logic: should be > instead of <
Syntax: should be indented. Missing Quotation mark also.
Syntax: incorrect spelling
Created by Mr Suffar
Revisit phase – COLD CALL
What is the definition of:
Syntax error:
Logic error:
Created by Mr Suffar
Iteration: While loop
Lesson 11
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
Knowledge phase�
Theory:
Created by Mr Suffar
Knowledge phase�
Iteration: The repetition of a process/ section of code.
Examples: For loop, while loop and repeat – until loop (Pseudocode only)
Created by Mr Suffar
Count controlled iteration – For loop
An example of a count controlled loop is: For loops
A for loop is count controlled because you know the exact number of iteration that will occur.
Example:
The code will repeat 10 times.
Created by Mr Suffar
Condition controlled iteration – While loop
An example of a condition controlled loop is: While loop
A while loop is condition controlled because it will loop until a condition is met.
Example:
Condition
Colon
Indented which means
It is inside the loop
Created by Mr Suffar
Condition controlled iteration – While loop
The code below will repeat until the user enters “Suffar” when asked for a name. Then it will display “You are correct” once.
Note: Indentation indicates that the block of code is INSIDE the while loop.
Indented which means
It is inside the loop and will repeat
Created by Mr Suffar
Condition controlled iteration – While loop
You can set variables to either True or False to start a loop. Example below:
exits the while loop.
Created by Mr Suffar
Structure of a while loop
In a while loop, the process will repeat if the condition is True.
Created by Mr Suffar
Creating the same program using 2 different styles.
Example 1:
Example 2:
Created by Mr Suffar
Creating the same program using 2 different styles.
Example 1:
Example 2:
Created by Mr Suffar
Converting code from for loop to while loop
Example 1:
Example 2:
Created by Mr Suffar
Forever loop
The program below will repeat infinitely.
Created by Mr Suffar
Forever loop
You can exit a forever loop using the keyword “break”
Created by Mr Suffar
COLD CALL
Created by Mr Suffar
Tasks
Complete the tasks
Created by Mr Suffar
265. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
count = 10
while count >= 0:
print(count)
count = count – 1
Answer:
Created by Mr Suffar
266. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
total = 0
num = 1
while num != 0:
num = int(input("Enter a number (0 to quit): "))
total = total + num
print("Sum of numbers:", total)
Answer:
Created by Mr Suffar
267. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
num = int(input("Enter a number: "))
count = 1
while count <= num:
print(num, "x", count, "=", num * count)
count = count + 1
Answer:
Created by Mr Suffar
268. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
secret_number = 7
guess = 0
while guess != secret_number:
guess = int(input("Guess the number: "))
print("Congratulations! You guessed the correct number.")
Answer:
Created by Mr Suffar
269. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
base = int(input("Enter the base: "))
exponent = int(input("Enter the exponent: "))
while exponent > 0:
result = base ** exponent
exponent = exponent - 1
print("The result is:", result)
Answer:
Created by Mr Suffar
270. Copy the code below, run it and test it, then explain the purpose of the program/what the program does.
Explain the purpose of the code below:
sentence = input("Enter a sentence: ")
character = input("Enter a character: ")
count = 0
index = 0
while index < len(sentence):
if sentence[index] == character:
count = count + 1
index = index + 1
print("The number of occurrences of", character, "is:", count)
Answer:
Created by Mr Suffar
271. The program below must: ask user for a number, display whether the number is even or odd. Repeatedly ask for a number until a negative number is entered. When a negative number is entered. Exit the loop and display the total number of even numbers and the total number of odd numbers.
Copy the code below, run it and fix the errors.
even_count = 1
odd_count = 0
num = int(input("Enter a number")
while num >=1:
if num % 2 == 1:
even_count = even_count + 1
print(num"is even")
else
odd_count = odd_count + 0
print(num,"is odd")
num = int(input("Enter a number"))
print("Even numbers:", even_count
print(Odd numbers:", odd_count)
Paste the correct version below:
Created by Mr Suffar
272. The program below must: Repeatdly ask the user for a number until -1 is entered. Calculate and display the total and average of all numbers entered.
Copy the code below, run it and fix the errors.
count = 5
total = 2
while Truee:
number = integer(input("Enter a number (enter -1 to stop): "))
if number == -1
break
total = total+numbers
count = count+1
if count != 0:
average = total * count
print("The total is:",total)
print("The average is:", average)
else
print("No numbers were entered.")
Paste the correct version below:
Created by Mr Suffar
273. Create a program that: Repeatedly ask the user for a good football team name that wears “red shirt” until “Liverpool” is entered. If any other team is entered, display “not good enough”. When Liverpool is entered, display “Correct”.
team = _____("Enter team name")
while _____ != "_____":
_____("Not good enough")
team = _____("Enter team name again")
_____("Correct")
Copy the code above, fill the gaps then paste your code below:
Created by Mr Suffar
274. Create a program that:
Paste your code below:
Created by Mr Suffar
275. Create a program that:
Paste your code on the next slide:
Created by Mr Suffar
276) Create a program that:
Paste your code below:
Created by Mr Suffar
277. The school is holding an election to reward the top students: Create a program that:
Paste your code below:
Created by Mr Suffar
278) Create a program for a cashier, your program must:
Paste your code below:
Created by Mr Suffar
279) A cinema wants to record how many children and how many adults buy tickets for the “lion king” film. Create a program that:
Paste your code below:
Created by Mr Suffar
280. Code the following flowchart in python:
Paste your code below:
Created by Mr Suffar
281. Use a while loop to create the 2 times table up to 100. Display “You have finished” when you get to the number 100.
Paste your code below:
Created by Mr Suffar
282. Display “Hey” and “Bye” on separate lines 1000 times using a while loop.
Paste your code below:
Created by Mr Suffar
283. Create a program that:
Paste your code below:
Created by Mr Suffar
284. Create a program that:
Paste your code below:
Created by Mr Suffar
285. Create a program that:
Paste your code below:
Created by Mr Suffar
286. Borednite is a new game. When a character takes damage in the game, their health bar goes down.
The health bar starts to increase (regenerate) 5 seconds from the last time a player was hit and by 15% per second. At 100%, the health bar has 500 health points.
Create an algorithm that:
Hint: Use a while loop.
Paste your code below:
Created by Mr Suffar
Homework
Video: https://youtu.be/h40gdOKQkAA
Complete the Blooket:
Created by Mr Suffar
Revisit phase - Starter
Give 1 example of count controlled loop:
Give an example of a condition controlled loop:
What is the purpose of the code above:
What is the purpose of the code above:
Created by Mr Suffar
While loop & Trace table
Lesson 12
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
Theory
Video: https://youtu.be/h40gdOKQkAA
Created by Mr Suffar
Example of a simple while loop trace table:
x | x < 5 | Output |
| | |
| | |
| | |
| | |
| | |
x = 1
While x < 5:
print(x*2)
x = x + 1
print(" The end ")
1
True
2
2
True
4
3
True
6
4
True
8
5
False
The end
Created by Mr Suffar
Assume the user enters the following inputs: 12,10,20,9
num | num>=10 | Output |
| | |
| | |
| | |
| | |
num = int(input("Enter number"))
while num >= 10:
print("Incorrect")
num = int(input("Enter number"))
print("Correct")
12
True
Incorrect
10
True
Incorrect
20
True
Incorrect
9
False
correct
Created by Mr Suffar
Assume the user enters the following values: “yes”, “no”, “chicken”
x | dancer | x < 3 | choice | output |
| | | | |
| | | | |
| | | | |
| | | | |
0
0
True
yes
great
1
1
True
no
Why not?
2
1
True
Chicken
Why not?
3
Created by Mr Suffar
Tasks
Complete task
Created by Mr Suffar
287. Complete the trace table. Assume the user enters the following values: “Tom”,”Sarah”,”Andy”,”Ed”
singer | singer != "Ed" | Output |
| | |
| | |
| | |
| | |
Created by Mr Suffar
288. Complete the trace table.
x | y | x < 5 | x < 3 | Output |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
Created by Mr Suffar
289. Complete the trace table. Then write the final value of letter:
Final value of letter: rl
x | name | x < 4 | Output | letter |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
Created by Mr Suffar
290. Complete the trace table. Assume the user enters the following numbers: 10, 50, 300,5, 1000
Highest | lowest | number | Output |
| | | |
| | | |
| | | |
| | | |
| | | |
Created by Mr Suffar
291. Complete the trace table. You may not need all the spaces in the trace table.
Enter the final value of z:
z = 0
x | y | z | total | Output |
| | | | |
| | | | |
| | | | |
| | | | |
Created by Mr Suffar
292. Complete the trace table.
x | y | z | Output |
| | | |
| | | |
| | | |
| | | |
Created by Mr Suffar
293. Complete the trace table.
num | num < 5 | Output |
| | |
| | |
| | |
| | |
| | |
Created by Mr Suffar
294. A league is holding player of the month selection. Create a program that:
Paste your code below:
Created by Mr Suffar
295. Create a program that:
Paste your code below:
Created by Mr Suffar
296. A shop owner has a charity box. She wants to create an algorithm that counts how many customers put money in the charity box. Create an algorithm that:
Paste your code below:
Created by Mr Suffar
297. Create a program which:
Paste your code below:
Created by Mr Suffar
298. Create a program that:
Paste your code below:
Created by Mr Suffar
299. Create an algorithm that calculates the total sum of internal angles in degrees of a regular polygon using the following formula: ”(N - 2) x 180“ where n is the number of sides. N will always be greater than 2.
Create a program that:
Paste your code below:
Created by Mr Suffar
300. Create a program that calculates the highest and lowest positive number entered. Your program must:
Paste your code below:
Created by Mr Suffar
Task 301
Answer:
Created by Mr Suffar
Task 302
Answer:
Answer:
Created by Mr Suffar
Task 303
Answer:
Created by Mr Suffar
Task 304
Answer:
Created by Mr Suffar
305. Create a program that:
Paste your code below:
Created by Mr Suffar
Task 306
Answer:
Created by Mr Suffar
Task 307
Answer:
Created by Mr Suffar
TASK 308
Answer:
Created by Mr Suffar
Task 309
Answer:
Created by Mr Suffar
Task 310
Answer:
Created by Mr Suffar
TASK 311
Answer:
Created by Mr Suffar
Task 312
Answer:
Created by Mr Suffar
Homework
Video: https://youtu.be/umo-sBtmcaw
Blooket: https://dashboard.blooket.com/set/61ade34d3cad7942c4ef4684
Created by Mr Suffar
Revisit phase – Starter – Data types
Identify 5 different data types used in programming and give an example of each?
Created by Mr Suffar
While loop & programming constructs
Lesson 14
Tuesday, July 18, 2023
Lesson objectives…
Created by Mr Suffar
Theory
Video: https://youtu.be/umo-sBtmcaw
Created by Mr Suffar
Programming constructs
There are 3 programming constructs:
Created by Mr Suffar
Sequence
Sequence: The concept of one statement being executed after another.
All statements will run each time.
Example:
Created by Mr Suffar
Selection (conditional statement)
Selection: A condition is used to decide whether code should be executed or which statements are to be executed.
Example: If statement
Created by Mr Suffar
Selection (conditional statement)
Selection: May or may not run depending on a condition.
Example: If statement
Created by Mr Suffar
Selection (conditional statement)
Switch Case is another type of Selection.
It is a conditional statement to deal with many possible outcomes.
Example: Switch case (PSEUDOCODE ONLY)
Created by Mr Suffar
Iteration
Iteration: A construct where code is executed repeatedly a set number of times or until a condition is met.
Count controlled:
Fixed number of repetitions.
Condition controlled
Created by Mr Suffar
Iteration
Iteration: A construct where code is executed repeatedly a set number of times or until a condition is met.
Condition controlled – (PSEUDOCODE ONLY)
Created by Mr Suffar
Iteration
Difference between while and repeat until:
Created by Mr Suffar
Questions – Cold Call
Which programming construct was used in the above program?
Created by Mr Suffar
Questions – Cold Call
Which programming construct was used in the above program?
Created by Mr Suffar
Questions – Cold Call
Which programming construct was used in the above program?
Created by Mr Suffar
Questions – Cold Call
Which programming construct was used in the above program?
Created by Mr Suffar
Questions – Cold Call
Which programming construct was used in the above program?
Created by Mr Suffar
Questions – Cold Call
Identify the line numbers where sequence occurred?
Identify the line numbers where selection occurred?
Created by Mr Suffar
Questions – Cold Call
Identify the line number where iteration starts
Identify the line number where selection starts?
Created by Mr Suffar
Apply your knowledge:
Log on kahoot:
https://create.kahoot.it/share/programming-constructs-for-loops/b386c8e4-ace7-434f-8837-2ef28efccebe
Created by Mr Suffar
Count vs condition controlled iteration
Count: The loop runs a set number of times which means the number of iteration is known before it starts.
Condition: The loop runs until a condition is met.
Created by Mr Suffar
Task 313
Created by Mr Suffar
Task 314
Answer:
Answer:
Answer:
Created by Mr Suffar
Task 315
✔
✔
✔
✔
Created by Mr Suffar
Task 316
Answer:
Created by Mr Suffar
Task 317
✓
✓
✓
✓
Created by Mr Suffar
Task 318
Answer:
Created by Mr Suffar
319. A supermarket does not allow customers to buy more than 3 toilet rolls. The supermarket charges £2 for 1 toilet roll, £6 for 2 toilet rolls, £12 for 3 toilet rolls.
Create an algorithm that:
Paste your code below:
Created by Mr Suffar
320. Create a program that:
Paste your code below:
Created by Mr Suffar
321. Create a program for a customer who wants to buy a group ticket to a cinema.
The following restrictions applies to a group ticket:
The program repeats until the customer enters valid inputs for the number of tickets, number of children and number of adults. Calculate and display the total amount needs to be paid.
Paste your code below:
Created by Mr Suffar
322. A ride in Chicken World has limits to who can ride. Customers must be at least 135 CM tall and must not be pregnant.
Create an algorithm that:
Paste your code below:
Created by Mr Suffar
323) A cat café wants to know how the number of males and females entering his store in a single day and wants to create an algorithm for it. Create an algorithm that:
Paste your code below:
Created by Mr Suffar
324. A supermarket is adding new measures to stop stock piling. Create an algorithm that allows the customer to buy a maximum of 1 hand sanitiser and 1 toilet roll and a maximum of 2 of the same items. The customers can not spend over £100.
Create an algorithm that:
Paste your code below:
Created by Mr Suffar
325. Create a program that:
Paste your code below:
Created by Mr Suffar
Task 326
Answer:
Created by Mr Suffar
Task 327
Answer:
Created by Mr Suffar
Task 328
Answer:
Answer:
Created by Mr Suffar
329. Create a program that:
Paste your code below:
Created by Mr Suffar
Task 330
Answer:
Answer:
Answer:
Answer:
Created by Mr Suffar
Task 331
Answer:
Created by Mr Suffar
March 2023
Task 332
Created by Mr Suffar
Specimen1
Task 333
Created by Mr Suffar
Task 334
Answer:
Answer:
Answer:
Answer:
Created by Mr Suffar
November 2020 – v3
Task 335
Answer:
Answer:
Answer:
Answer:
Created by Mr Suffar
Task 336
Created by Mr Suffar
Task 337
Answer:
Created by Mr Suffar
Task 338
✓
✓
✓
✓
Created by Mr Suffar
Task 339
Answer:
Answer:
Answer:
Created by Mr Suffar
Task 340
Write your answer in python below:
Created by Mr Suffar
Task 341
Answer:
Created by Mr Suffar
Task 342
Created by Mr Suffar
Task 343
Answer:
Answer:
Created by Mr Suffar
Task 344
Answer:
Created by Mr Suffar
345. Create a program that:
Asks the user for a binary number. Validate it contains 8 characters only and must have 1s and 0s only. If valid, display “Binary number accepted”, otherwise, repeat the question again.
Paste your code below:
Created by Mr Suffar
Task 346
Answer:
Created by Mr Suffar
Task 347
Answer:
Created by Mr Suffar
Homework: Revise for end of unit assessment.
Complete kahoot:
https://create.kahoot.it/share/programming-constructs-for-loops/b386c8e4-ace7-434f-8837-2ef28efccebe
Created by Mr Suffar
End of unit test
NOW:
Complete end of unit assessment.
MS Form assessment - test link: https://forms.office.com/Pages/ResponsePage.aspx?id=NRrmRxWbmk-P3e1XFrwgvUKZUnHi_FpMtvQIsO11-sxURDQ0RkJHNTFQWDA2UTEwRFpKVVBDNEw3TC4u
THEN:
Complete any unfinished tasks from previous lessons.
Lesson 15
Created by Mr Suffar