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

Описание к видео IGCSE Computer Science 2023-25 ​​- Topic 8: Programming (4) - Functions and Procedures

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.

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

#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()

Комментарии

Информация по комментариям в разработке