Assignment Operators
Used to update Variables:
Used to update Variables:
x = 10
x += 5 # x = x + 5
x -= 2 # x = x - 2
x *= 3
x /= 2
Mini Practice Tasks
Task A
Create two numbers and print:
their sum
their difference
their product
their remainder
Task B
Ask the user for age and check if they are above 18:
Task A
Create two numbers and print:
their sum
their difference
their product
their remainder
Task B
Ask the user for age and check if they are above 18:
Hint: Use The input() Function to accept the age:
print("After You done these tasks Try to Build a Simple Calculator Using the Arithmetic and Conditional Operators")โ
DAY 5
Conditionals: if and else (Python)
Conditionals are used to make decisions in a program.
Syntax
Example
Output
---
โ Uses True/False conditions
โ Executes different code blocks
โ Very important for beginners
Conditionals: if and else (Python)
print("What are conditionals?")Conditionals are used to make decisions in a program.
Syntax
if condition:
# code runs if condition is True
else:
# code runs if condition is False
Example
age = 18
if age >= 18:
print("You are eligible to vote")
else:
print("You are not eligible to vote")
Output
You are eligible to vote
---
โ Uses True/False conditions
โ Executes different code blocks
โ Very important for beginners
๐1
Try to rebuild the calculator using conditionals as well if you have questions then feel free to ask!!
โ
DAY 6 Python elif & Nested Conditions
handles two conditions
is used when there are more than two possibilities.
Python checks conditions from top to bottom.
The first True condition runs, the rest are ignored.
โ ๏ธ Order matters!
An if inside another if.
Real Life Example
python
print('Why elif?')
if/else
handles two conditions
elif
is used when there are more than two possibilities.
score = 75
if score >= 90:
print("Grade: A")
elif score >= 70:
print("Grade: B")
else:
print("Grade: C")
print("Flow Of Execution")Python checks conditions from top to bottom.
The first True condition runs, the rest are ignored.
โ ๏ธ Order matters!
print("Nested if Statements")An if inside another if.
age = 20
has_id = True
if age >= 18:
if has_id:
print("Access granted")
else:
print("ID required")
else:
print("Underage")
Real Life Example
balance = 500
if balance > 0:
if balance >= 1000:
print("Premium user")
else:
print("Standard user")
else:
print("No balance")
๐ฅ1
Are you passionate about using #artificialIntelligence to solve real-world problems? Do you have an AI-powered idea or prototype that can improve public services in #Ethiopia?
The Ethiopian Artificial Intelligence Institute invites innovators, researchers, students, startups, and public-interest technologists to apply for Eth-Timbuktoo AI UniPod; a collaborative AI studio focused on building solutions with real public impact.
Participants will work in multidisciplinary teams, receive expert mentorship, and strengthen AI solutions designed for Ethiopiaโs digital and institutional context. This is a unique opportunity to collaborate, learn, and transform innovative ideas into practical tools for better public services.
๐ Apply here: [https://forms.gle/inHZ9sByu73QsiJP7]
๐ Application Deadline: December 20, 2025
๐ Phone: +251 904187791 / +251 943545950
follow ๐ t.me/ignitic_tech
Women applicants are highly encouraged to apply.
Join us and be part of shaping AI for better public services.
The Ethiopian Artificial Intelligence Institute invites innovators, researchers, students, startups, and public-interest technologists to apply for Eth-Timbuktoo AI UniPod; a collaborative AI studio focused on building solutions with real public impact.
Participants will work in multidisciplinary teams, receive expert mentorship, and strengthen AI solutions designed for Ethiopiaโs digital and institutional context. This is a unique opportunity to collaborate, learn, and transform innovative ideas into practical tools for better public services.
๐ Apply here: [https://forms.gle/inHZ9sByu73QsiJP7]
๐ Application Deadline: December 20, 2025
๐ Phone: +251 904187791 / +251 943545950
follow ๐ t.me/ignitic_tech
Women applicants are highly encouraged to apply.
Join us and be part of shaping AI for better public services.
I hope you guys are practicing what i am posting here. the last five days are productive for you guys because we are advancing to sections that are a little bit more advanced sections that require your time and practice
โ
Day 7
Python Lists (Collections Basics)
In real life, you make lists all the time:
- Shopping list
- Contact list
- Student list
In Python, a list is used to store multiple values in a single variable.
Instead of doing this โ:
You do this โ :
Python Lists (Collections Basics)
print("What are Python Lists?")In real life, you make lists all the time:
- Shopping list
- Contact list
- Student list
In Python, a list is used to store multiple values in a single variable.
Instead of doing this โ:
student1 = "Ali"
student2 = "Sara"
student3 = "John"
You do this โ :
students = ["Ali", "Sara", "John"]
๐ A list:
* Can store many values
* Can store different data types
* Keeps items in order
* Allows duplicates
* Can be changed(mutable)
* Can store many values
* Can store different data types
* Keeps items in order
* Allows duplicates
* Can be changed(mutable)
Creating a List
Syntax:
Examples:
๐ Important:
Lists are written using square brackets [ ]
Syntax:
list_name = [item1, item2, item3]
Examples:
numbers = [1, 2, 3, 4]
names = ["Nova", "Alex", "Marta"]
mixed = [1, "Python", True, 3.5]
๐ Important:
Lists are written using square brackets [ ]
Accessing List Items (Indexing) โ VERY IMPORTANT
Each item in a list has a position number, called an index.
๐ Python starts counting from 0, not 1.
Example:
| Item | Index |
| ---- | ----- |
| Ali | 0 |
| Sara | 1 |
| John | 2 |
Each item in a list has a position number, called an index.
๐ Python starts counting from 0, not 1.
Example:
names = ["Ali", "Sara", "John"]
| Item | Index |
| ---- | ----- |
| Ali | 0 |
| Sara | 1 |
| John | 2 |
Accessing Items:
โ ๏ธ Common Mistake:
Because index 3 does not exist.
print(names[0]) # Ali
print(names[1]) # Sara
print(names[2]) # John
โ ๏ธ Common Mistake:
print(names[3]) # ERROR (index out of range)
Because index 3 does not exist.
Changing List Items (Mutability)
Lists are mutable, meaning you can change them after creation.
๐ Strings and numbers alone cannot be changed like this, but lists can.
Lists are mutable, meaning you can change them after creation.
names = ["Ali", "Sara", "John"]
names[1] = "Nova"
print(names)
['Ali', 'Nova', 'John']
๐ Strings and numbers alone cannot be changed like this, but lists can.
Adding Items to a List
โ append() โ add to the end
Output:
โ insert() โ add at a specific index
Result:
โ append() โ add to the end
numbers = [1, 2, 3]
numbers.append(4)
print(numbers)
Output:
[1, 2, 3, 4]
โ insert() โ add at a specific index
numbers.insert(1, 10)
Result:
[1, 10, 2, 3, 4]
Removing Items from a List
โ remove() โ remove by value
โ pop() โ remove by index (or last item)
๐ pop() is useful when you want the last added item removed.
โ remove() โ remove by value
numbers.remove(10)
โ pop() โ remove by index (or last item)
numbers.pop() # removes last item
numbers.pop(0) # removes first item
๐ pop() is useful when you want the last added item removed.
Length of a List (len())
To know how many items are in a list:
Output:
This is very useful with loops.
To know how many items are in a list:
fruits = ["apple", "banana", "mango"]
print(len(fruits))
Output:
3
This is very useful with loops.
For Today Lets stop here and try these. if you finish these you can go ahead check about looping through lists it will be our tomorrow challenge that we will tackle.
Forwarded from INSA Cyber Talent Center
แจแขแแณ แณแญแ แญ แณแแแต แจแฆแแญแ แฅแ แ
แณแ แฅแ แฅแแต แตแแ แ แแแตแ แต แแแแฃ แ แ
แญแฅ แฅแแแแซแแแข แ แฐแแญ แ แณแญแ แญ แฐแ
แแแต แฅแ แดแจแแแแแต แแแช แฅแ แขแแตแญแแฒแฌแต แจแแแฝแ แซแแแแแฝแ แจแถแตแต แแญ แตแแ แ แตแแ แแแแฃแ แฅแแณแซแแแฃแฝแแข แแแฐแแต แแฐแแปแฝแแ แแจแแแ แ แตแญแทแธแแข แ แตแญแ แแแฎ แฅแ แ แ แแ แต แแแ แจแณแญแ แญ แฐแ
แแแต แฃแแแซ แจแแซแฐแญแแตแ แตแแ แ แ แแป แญแแฐแฑแข
@insactc
@insactc
๐ฅ1