HomeUncategorizedpython-intro

python-intro

🚀 Introduction to Python for Beginners

Welcome to this beginner-friendly guide to Python programming. In this lesson, you’ll learn the basics of Python with simple explanations and practical code examples.


📌 What is Python?

Python is a high-level, easy-to-learn programming language used for:

  • Web Development
  • Data Science
  • Automation
  • AI & Machine Learning

🧠 Why Learn Python?

  • Simple syntax (easy to read & write)
  • Huge community support
  • Used by top companies

⚙️ Setting Up Python

  1. Download Python from https://python.org
  2. Install it on your system
  3. Verify installation:
python --version

✍️ Your First Python Program

print("Hello, World!")

Output:

Hello, World!

📦 Variables in Python

name = "Haris"
age = 22

print(name)
print(age)

🔢 Data Types

# Integer
x = 10

# Float
y = 10.5

# String
name = "Python"

# Boolean
is_active = True

🔁 Conditional Statements

age = 18

if age >= 18:
    print("You are eligible to vote")
else:
    print("You are not eligible")

🔄 Loops

For Loop

for i in range(5):
    print(i)

While Loop

count = 0

while count < 5:
    print(count)
    count += 1

🧩 Functions

def greet(name):
    return f"Hello, {name}!"

print(greet("Haris"))

📚 Lists

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

for fruit in fruits:
    print(fruit)

🧠 Mini Practice Task

Write a program to print even numbers from 1 to 10:

for i in range(1, 11):
    if i % 2 == 0:
        print(i)

🎯 Conclusion

You’ve learned:

  • Python basics
  • Variables & data types
  • Loops & conditions
  • Functions

👉 Next Step: Try building small projects!


💡 Bonus Challenge: Simple Calculator

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

print("Addition:", num1 + num2)
print("Subtraction:", num1 - num2)
print("Multiplication:", num1 * num2)
print("Division:", num1 / num2)

🔥 Keep learning. Keep building.

Share: 

No comments yet! You be the first to comment.

Leave a Reply

Your email address will not be published. Required fields are marked *