IGCSE Computer Science 2023-25 ​​- Topic 8: Programming (4) - Functions and Procedures

preview_player
Показать описание
This is the 4th video for Topic 8 we learn that when creating an algorithm, there are often repetitive actions that involve similar sets of statements. To avoid having to rewrite the same code every time these actions are needed, many programming languages utilize subroutines - commonly referred to as functions or named procedures. Functions are defined once and can be invoked multiple times within a single program.

#Computer Science #IGCSE #Exams #Cambridge #programming #coding

VIDEO to support Computer Science Syllabus
Cambridge IGCSE™ (9–1 0984) (A*-C 0478)
For exams in 2023, 2024 and 2025.

Cambridge IGCSE Computer Science helps learners develop an interest in computational thinking and an understanding of the principles of problem-solving using computers. They apply this understanding to create computer-based solutions to problems using algorithms and a high-level programming language. Learners also develop a range of technical skills, and the ability to effectively test and evaluate computing solutions.

Studying Cambridge IGCSE Computer Science helps learners appreciate current and emerging computing technologies, the benefits of their use and recognise their potential risks. It provides an ideal foundation for progression to Cambridge International AS & A Level and is valuable for other areas of study and everyday life.

THE CODE:
-------------------------------------------------------------------------------------------------------
x = 10

def my_function():
y = 5
print("Inside the function, the value of x is:", x)
print("Inside the function, the value of y is:", y)

my_function()
print("Outside the function, the value of x is:", x)

-------------------------------------------------------------------------------------------------------

def celsius(temperature):
return (temperature -32) / 1.8

my_temp = float(input("Enter temperature in Fahrenheit: "))
my_temp = celsius(my_temp)
print("Temperature in Celsius:", my_temp)

------------------------------------------------------------------------------------------------------

def calculate_area(length):
area = length * length
return area

length = float(input("Enter the length size: "))
print("The area of the square is:", calculate_area(length))

------------------------------------------------------------------------------------------------------
def add(a, b):
return a + b

def subtract(a, b):
return a - b

def cylinder_volume(a, b):
pi = 3.14
return pi * b**2 * a

def main():
print("Welcome to the calculator program")
print("1. Addition")
print("2. Subtraction")
choice = int(input("Enter your choice (1/2): "))

num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))

if choice == 1:
result = add(num1, num2)
print(f"The result of addition is: {result}")
elif choice == 2:
result = subtract(num1, num2)
print(f"The result of subtraction is: {result}")
else:
print("Invalid choice. Please try again.")

main()
Рекомендации по теме
Комментарии
Автор

Mr.Bulmer, I have been a constant viewer of your IGCSE/O level computer science series and I would like to tell you about all the students you are helping. Your videos have been a lifesaver and have saved me multiple times.

DawoodKhan-kniu
Автор

Mr bulmer . You are a real lifesaver as tommorows my p2 0478 exam

mongsway
Автор

Hello Mr bulmer, I would just like to thank you for these videos, our computer science teacher isn’t that good and you have single Handedly saved our exams with your videos.
- students of Dubai
thank you

vivankewalani
Автор

Im a new subscriber - Will you cover the entire chapter 8 in your channel?

Waterbots
Автор

11:35 don't you need to have a return every time for functions

muhammadfaizan
Автор

Thanks Mr when writing a program in python for 15 mark question can I use if elif in python or just if

mohammedkawasmi
Автор

Hello, how are you : is it necessary to use programming language as python or another programing language, ,, or only pseudocode in the exam for paper2.. thanks

hudabourini