... ArdiLand Institute of Technology Python Programming Basics – Quick Note | Ardiland Institute of Technology
540-440-1540‬
USD ($)
$
United States Dollar
Br
Ethiopian Birr

Python Programming Basics – Quick Note

Created by Adugna Asrat in Quick Notes 27 Mar 2025
Share

🚀 What is Python?

Python is a high-level, interpreted programming language known for its simplicity, readability, and wide usage in web development, AI, data science, automation, and more. Created by Guido van Rossum in 1991, it is one of the most popular languages globally.


🧩 1. 🧱 Python Basics

📦 What is a Variable?

A variable is a name that stores data in a program. It acts as a container that holds values.

name = "ArdiLand"   # Variable storing a string


📊 What are Data Types?

Data Types define the kind of data a variable can hold.

Common Python data types:

  • int: Whole numbers (e.g., 10)

  • float: Decimal numbers (e.g., 3.14)

  • str: Strings/text (e.g., "Hello")

  • bool: Boolean values (True, False)

  • list, tuple, dict, set: Collection types

Example:

age = 21          # int

name = "Maya"     # str

price = 19.5      # float

is_active = True  # bool


🖨️ Output Function

To display output, use the built-in print() function:

print("Welcome to Ardiland!")


➕ 2. 🔢 Operators

Operators are special symbols used to perform operations on variables and values.

  • Arithmetic: +, -, *, /, %, **

  • Comparison: ==, !=, <, >

  • Logical: and, or, not

  • Assignment: =, +=, -=

Example:

x = 5

y = 3

print(x + y)  # 8


🔁 3. 🔍 Conditional Statements & Loops

✅ What are Conditional Statements?

Conditional Statements let your code make decisions. They check if conditions are True or False.

if age >= 18:

    print("You are an adult")

else:

    print("You are a minor")


🔄 What is a Loop?

A loop allows you to repeat a block of code multiple times.

👉 For Loop

for i in range(3):

    print(i)

👉 While Loop

x = 0

while x < 3:

    print(x)

    x += 1


🧠 4. 🧩 Functions

🔹 What is a Function?

A function is a reusable block of code that performs a specific task. It is defined using the def keyword.

def greet(name):

    return f"Hello, {name}"


🔹 Function Arguments

  • *args: Accepts multiple positional arguments

  • **kwargs: Accepts multiple keyword arguments

  • lambda: Anonymous function


📚 5. 📦 Data Structures

📋 What is a List?

A list is an ordered, mutable collection of items.

fruits = ["apple", "banana", "orange"]


🧾 What is a Dictionary?

A dictionary stores data as key-value pairs.

student = {"name": "Maya", "grade": "A"}


🧊 Tuple

A tuple is like a list but immutable (unchangeable).

coordinates = (10, 20)


🔁 Set

A set is an unordered collection with no duplicates.

unique_items = {1, 2, 3}


🧱 6. 🧑‍🏫 Object-Oriented Programming (OOP)

🧩 What is a Class?

A class is a blueprint for creating objects. It defines properties (attributes) and behaviors (methods).

class Student:

    def __init__(self, name):

        self.name = name


🧍 What is an Object?

An object is an instance of a class. It holds real data.

s1 = Student("Christian")


🧰 OOP Concepts:

  • Encapsulation – Hiding internal data

  • Inheritance – Child class inherits parent class

  • Polymorphism – Same method, different behavior

  • Abstraction – Hiding complexity, showing essentials


📂 7. 📄 File Handling

🗂️ What is File Handling?

Python can read/write files using open().

with open("data.txt", "w") as f:

    f.write("ArdiLand Notes")


🚨 8. 🛡️ Exception Handling

❗ What is Exception Handling?

Python uses try...except blocks to handle errors and prevent crashes.

try:

    result = 10 / 0

except ZeroDivisionError:

    print("Cannot divide by zero")


📦 9. Python Libraries & Tools

Area

Library

Web Dev

Flask, Django

Data

Pandas, NumPy

ML/AI

TensorFlow, Scikit-learn

Visualization

Matplotlib, Seaborn


🌍 10. Applications of Python

✅ Web Development

✅ Data Science

✅ Machine Learning & AI

✅ Automation & Scripting

✅ Web Scraping

✅ Game Development


💼 Careers in Python

Role

Avg Salary (USD)

Python Dev

$60K–110K

Data Scientist

$70K–130K

ML Engineer

$75K–140K

Backend Dev

$70K–125K

Comments (0)

Share

Share this post with others