0% found this document useful (0 votes)
4 views4 pages

Isala Note

The document explains data buses as communication systems within computers, detailing types such as data, address, and control buses, and their importance in system performance. It also covers Python functions, including their definition, syntax, and key concepts like parameters, return values, and scope. Additionally, it highlights the benefits of using functions in programming and provides exam tips for understanding and writing Python functions.

Uploaded by

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

Isala Note

The document explains data buses as communication systems within computers, detailing types such as data, address, and control buses, and their importance in system performance. It also covers Python functions, including their definition, syntax, and key concepts like parameters, return values, and scope. Additionally, it highlights the benefits of using functions in programming and provides exam tips for understanding and writing Python functions.

Uploaded by

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

Data Buses and Python Functions - Edexcel IGCSE

Computer Science
Data Buses
What is a Data Bus?

A data bus is a communication system that transfers data between


components inside a computer. Think of it as a highway where data travels
between different parts of the computer system.

Key Types of Buses:

1. Data Bus

o Carries the actual data being processed

o Bidirectional (data flows in both directions)

o Width determines how much data can be transferred at once


(e.g., 64-bit bus)

2. Address Bus

o Carries memory addresses

o Unidirectional (addresses only flow from CPU to memory)

o Width determines maximum addressable memory

3. Control Bus

o Carries control signals and commands

o Controls when devices can access the bus

o Manages read/write operations

Importance in Computer Architecture:

 Buses determine system performance and throughput

 The wider the bus, the more data can be transferred simultaneously

 Bus speed (measured in MHz) affects overall system speed

 Modern computers use high-speed bus architectures like PCI Express


Python Functions
Definition

A function is a reusable block of code designed to perform a specific task.


Functions help make code more organized, reusable, and easier to debug.

Basic Function Syntax

def function_name(parameters):

"""Docstring - explains what the function does"""

# Function code block

return value # Optional return statement

Example 1: Simple Function

def greet(name):

"""This function greets the person passed in as a parameter"""

return f"Hello, {name}!"

# Calling the function

message = greet("Alex")

print(message) # Outputs: Hello, Alex!

Example 2: Function with Default Parameters

def calculate_area(length, width=1):

"""Calculate area of a rectangle with optional width parameter"""

return length * width

# Different ways to call

print(calculate_area(5, 3)) # Outputs: 15

print(calculate_area(5)) # Outputs: 5 (using default width=1)


Example 3: Function Returning Multiple Values

def get_dimensions():

"""Return multiple values from a function"""

length = 10

width = 5

height = 3

return length, width, height

# Unpacking returned values

l, w, h = get_dimensions()

print(f"Length: {l}, Width: {w}, Height: {h}")

Key Concepts:

1. Parameters and Arguments

o Parameters are variables in the function definition

o Arguments are the actual values passed to the function

2. Return Values

o Functions can return data using the return statement

o Without a return statement, functions return None by default

o You can return multiple values (as a tuple)

3. Scope

o Variables defined inside a function have local scope

o They cannot be accessed outside the function

o Global variables can be accessed but not modified without global


keyword
4. Why Use Functions?

o Code reusability: Write once, use many times

o Modularity: Break complex problems into smaller parts

o Readability: Makes code easier to understand

o Maintainability: Easier to debug and modify

Exam Tips:

 Be able to read, interpret, and write simple Python functions

 Understand parameter passing and return values

 Know how to call functions with different arguments

 Recognize the importance of functions in program design

You might also like