Python Sikhein - Basic se Advanced

Python Sikhein - Basic se Advanced

Python Sikhein - Basic se Advanced

Is tutorial me hum Python programming ke basic se lekar advanced topics tak cover karenge.

1. Python Introduction

Python ek high-level, interpreted programming language hai jo simple syntax aur readability ke liye famous hai.

2. Python Install Karna

Python install karne ke liye aap official website se download kar sakte hain.

3. Hello World Program

print("Hello, World!")

4. Variables aur Data Types

x = 10  # Integer
y = 3.14  # Float
name = "Python"  # String
is_active = True  # Boolean

5. Conditional Statements

x = 10
if x > 5:
    print("x bada hai 5 se")
elif x == 5:
    print("x barabar hai 5 ke")
else:
    print("x chhota hai 5 se")

6. Loops (for aur while)

# For loop
for i in range(5):
    print(i)

# While loop
x = 0
while x < 5:
    print(x)
    x += 1

7. Functions

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

print(greet("Amit"))

8. Lists and Tuples

# List
fruits = ["apple", "banana", "cherry"]
print(fruits[0])

# Tuple
days = ("Monday", "Tuesday", "Wednesday")
print(days[1])

9. Dictionary

student = {"name": "Amit", "age": 20, "course": "Python"}
print(student["name"])

10. Object-Oriented Programming (OOP)

class Student:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def show(self):
        print(f"Name: {self.name}, Age: {self.age}")

s1 = Student("Amit", 20)
s1.show()

11. Exception Handling

try:
    x = 10 / 0
except ZeroDivisionError:
    print("Zero se divide nahi kar sakte")

12. File Handling

# File write karna
with open("file.txt", "w") as f:
    f.write("Hello, Python!")

# File read karna
with open("file.txt", "r") as f:
    print(f.read())

13. Python Modules

import math
print(math.sqrt(16))

14. Web Scraping

import requests
from bs4 import BeautifulSoup

url = "https://example.com"
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
print(soup.title.text)

15. Data Science with Pandas

import pandas as pd

data = {"Name": ["Amit", "Raj"], "Age": [20, 25]}
df = pd.DataFrame(data)
print(df)

16. Machine Learning with Scikit-Learn

from sklearn.linear_model import LinearRegression
import numpy as np

X = np.array([[1], [2], [3]])
y = np.array([2, 4, 6])
model = LinearRegression()
model.fit(X, y)
print(model.predict([[4]]))

17. Django Web Framework

# Django install karein
pip install django

# Django project banayein
django-admin startproject myproject

18. REST API with Flask

from flask import Flask, jsonify

app = Flask(__name__)

@app.route("/", methods=["GET"])
def home():
    return jsonify({"message": "Hello, Flask!"})

if __name__ == "__main__":
    app.run(debug=True)

19. Automation with Selenium

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://google.com")

20. Conclusion

Ab aapne Python ke basic se lekar advanced concepts tak seekh liya hai. Practice karte rahiye aur naye projects banate rahiye!

Comments

Popular posts from this blog

टॉप 10 AI वीडियो, इमेज और चैट एआई टूल्स - 2025

GTA 6 ke liye Sasta PC Build

Top 7 Strategies to Maximize ROI in Digital Marketing | 2024 Expert Guide