24th November 2023
Programming and Problem Solving is an integral part of the IGCSE Computer Science Course. The skills learnt, though challenging, are a fundamental part of this STEM subject. The Year 10 students have worked very hard this year to master these skills. Read on to find out our students' explanations of some of the key aspects of Programming and Problem Solving.
In Year 10 we have been looking at programming and problem solving and one of the topics in programming and problem solving is totaling, counting and averages and I am going to give you a brief explanation on what these things are.
Totaling
Totaling is used to sum up all the numbers in a list
The code for this is Total<—total+number
You can use this in python code, pseudocode and flowchart
Counting
Counting is used to find how many numbers are there in a list. Counting can keep track of how many irritations your program has performed in a loop.
The code is count<— count+1
Averages
Average, which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.
The code is average<— Total / count
What are functions? In computer science, a function is a fundamental concept that refers to a named sequence of instructions or statements that perform a specific task. Functions are used to organise code into manageable and reusable units.
Examples
def calculate_string_length(input_string):
length = len(input_string)
return length
string_length = calculate_string_length("Hello, World!")
print(string_length) # Output: 13
def find_maximum(a, b):
return max(a, b)
max_value = find_maximum(8, 12)
print(max_value) # Output: 12
Iterations are basically loops used in programming. You can represent loops in the form of pseudocode, python, and flowcharts. There are three loops we use. Repeat Until, Count Controlled(aka For Loop), and While Loop. Repeat until only exists in pseudocode and cannot be used/represented in python.
Repeat Until:
While Loop:
Count Controlled Loop:
Examples of Each Loop in Pseudocode:
Problem: Count from 1 to 10
//Counting
DECLARE Count: INTEGER
Count ← 0
REPEAT
Count ← Count + 1
OUTPUT Count
UNTIL Count = 10
//Counting
DECLARE Count: INTEGER
Count ←0
WHILE Count <10 DO
Count ←Count + 1
OUTPUT Count
ENDWHILE
//Counting
DECLARE Count: INTEGER
Count ← 0
FOR Count ←1 TO 10
OUTPUT Count
NEXT Count
Examples of Each Loop in Python:
#Counting
#DECLARE Count: INTEGER
Count=0
while count <10:
count = count + 1
print(count)
#Counting
#DECLARE Count: INTEGER
for count in range(1,10):
print(count)
Mr Took