Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/web-developement/python/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"label": "Python",
"position": 3,
"collapsible": true,
"collapsed": false,
"className": "python-category",
"link": {
"type": "generated-index",
"title": "Python Tutorial",
"slug": "/python",
"description": "Start here to learn Python from basics to commonly used libraries. Each page has examples and small exercises.",
"keywords": ["python", "tutorial", "beginner", "numpy", "pandas"]
}
}


34 changes: 34 additions & 0 deletions docs/web-developement/python/python-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: intro
title: Introduction
sidebar_position: 1
---

Welcome! This track covers Python fundamentals and popular libraries.
## What is Python ?
Python is one of the most popular programming languages. It’s simple to use, packed with features and supported by a wide range of libraries and frameworks. Its clean syntax makes it beginner-friendly. It's

- A high-level language, used in web development, data science, automation, AI and more.
- Known for its readability, which means code is easier to write, understand and maintain.
- Backed by library support, so we don’t have to build everything from scratch, there’s probably a library that already does what we need.

## Why to Learn Python?
- Requires fewer lines of code compared to other programming languages.
- Provides Libraries / Frameworks like Django, Flask, Pandas, Tensorflow, Scikit-learn and many more for Web -
- Development, AI/ML, Data Science and Data Analysis
- Cross-platform, works on Windows, Mac and Linux without major changes.
- Used by top tech companies like Google, Netflix and NASA.
- Many Python coding job opportunities in Software Development, Data Science and AI/ML.

## Get Started with Python
Install Python in your system.


**What you’ll learn**
- Syntax & variables
- Data types and data structures
- Functions & modules
- Virtual environments and pip
- NumPy & pandas basics

> Tip: You can run most examples in a REPL: `python` or `python3` in your terminal.
98 changes: 98 additions & 0 deletions docs/web-developement/python/python-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
title: Python Basics
sidebar_position: 2
---


# Variables and Syntax in Python

We'll learn the syntax and variables used in Python.

---

## Printing in Python
Python has a very simple and clean syntax, which makes it beginner-friendly.
```python
print("Hello, World!")
```
Thus prints - Hello, World!
Input and Output :
```python
name = input("Enter your name: ")
print("Hello,", name, "! Welcome!")
#Enter your name: Rohan
#Hello, Rohan"! Welcome!
```

## Variables
In Python, we assign variables some value.
Below are a few examples.
```python
x = 10 # int
pi = 3.14 # float
name = "Zarine" # str
is_ok = True # bool
```
💡 In Python, variables are case-sensitive (Name and name are different).

## Multiple Assignment
This is how we assign multiple variables at the same time!
```python

a, b, c = 1, 2, 3
x = y = z = 0 # all assigned to 0
```
## Naming Rules
There are some rules to be followed while naming a variable.
- Can contain letters, numbers, and underscores.
- Cannot start with a number.
- Keywords like for, if, while cannot be used as variable names.

Valid examples:

```python

user_name = "Alice"
marks1 = 90
_total = 100
```
Invalid:

```python

1value = 5 # ❌ cannot start with number
for = 10 # ❌ cannot use keyword
```
## Comments
Single line:

```python

# This is a comment
```
Multi-line (docstring style):

```python

"""
This is a
multi-line comment
"""
```
## 📝 Quick Exercise
Create three variables: age, pi, student_name. Assign appropriate values and print them.



---











52 changes: 52 additions & 0 deletions docs/web-developement/python/python-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
id: data-structures
title: Data Structures
sidebar_position: 3
---

# Data Structures in Python

Python comes with built-in data structures that make it powerful and easy to use.

---

## Lists
- Ordered, mutable (can be changed), allow duplicates.

```python
fruits = ["apple", "banana", "cherry"]
print(fruits[0]) # apple
fruits.append("mango")
print(fruits) # ['apple', 'banana', 'cherry', 'mango']
```
## Tuples

Ordered, immutable, allow duplicates.
```python
point = (10, 20)
print(point[1]) # 20
```

## Sets

Unordered, unique elements, no duplicates.
```python
tags = {"python", "ml", "ece", "python"}
print(tags) # {'ece', 'ml', 'python'}
```

## Dictionaries

Key-value pairs, unordered (insertion-ordered since Python 3.7).
```python
student = {"name": "Rohan", "year": 2, "branch": "ECE"}
print(student["name"]) # Rohan
student["year"] = 3
print(student) # {'name': 'Rohan', 'year': 3, 'branch': 'ECE'}
```

## 📝 Quick Exercises

- Create a list of your 5 favorite movies and print the 2nd one.
- Make a dictionary with your details (name, age, college). Print the age.
- Try to add a duplicate element to a set and see what happens.
69 changes: 69 additions & 0 deletions docs/web-developement/python/python-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
id: functions
title: Functions
sidebar_position: 4
---

# Functions in Python

Functions let you organize code into reusable blocks.

---

## Defining a Function
We define a function in Python with the use of def(). Below is an example.
```python
def greet():
print("Hello, welcome to Python!")

greet()
```
## Parameters and Arguments
We pass parameters and arguments through functions like in the example below.
```python
def add(a, b):
return a + b

result = add(10, 5)
print(result) # 15
```
## Default Parameters
```python
def greet_user(name="Guest"):
print(f"Hello, {name}!")

greet_user() # Hello, Guest!
greet_user("Zarine") # Hello, Zarine!
```

## Keyword Arguments
```python
def student_info(name, branch, year):
print(f"{name} studies {branch} in year {year}")

student_info(branch="ECE", year=2, name="Zarine")
```
## Variable Arguments (*args, **kwargs)
```python
def add_all(*nums):
return sum(nums)

print(add_all(1, 2, 3, 4)) # 10
```

## Lambda Functions

```python
square = lambda x: x * x
print(square(5)) # 25
```

## 📝 Quick Exercises
- Write a function multiply(x, y) that returns the product.
- Write a function is_even(num) that prints "Even" or "Odd".
- Create a lambda function that reverses a string.


---


93 changes: 93 additions & 0 deletions docs/web-developement/python/python-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
id: projects
title: Beginner Projects
sidebar_position: 5
---

# Projects with Python Basics

Now that you know **variables, data structures, and functions**, let’s build some small projects.

---

## 1. Calculator
Uses **variables + functions**.

```python
def add(a, b): return a + b
def sub(a, b): return a - b
def mul(a, b): return a * b
def div(a, b): return a / b

a = int(input("Enter first number: "))
b = int(input("Enter second number: "))

print("Addition:", add(a, b))
print("Subtraction:", sub(a, b))
print("Multiplication:", mul(a, b))
print("Division:", div(a, b))
```
## 2. Student Information Manager

Uses dictionaries + functions.
```python

def add_student(name, branch, year):
return {"name": name, "branch": branch, "year": year}

student1 = add_student("Zarine", "ECE", 2)
print(student1)
```

## 3. To-Do List App

Uses lists + loops.
```python

tasks = []

def add_task(task):
tasks.append(task)

def show_tasks():
print("Your Tasks:")
for i, t in enumerate(tasks, 1):
print(f"{i}. {t}")

add_task("Study Python")
add_task("Complete Assignment")
show_tasks()
```
## 4. Word Counter

Uses strings + functions.
```python
def word_count(text):
words = text.split()
return len(words)

sentence = "Python makes programming fun"
print("Word count:", word_count(sentence))
```

## 5. Guess the Number Game

Uses loops + conditions + random module.
```python
import random

secret = random.randint(1, 10)
guess = int(input("Guess a number (1-10): "))

if guess == secret:
print("🎉 Correct!")
else:
print("❌ Wrong! The number was", secret)
```

## 📝 Mini Challenges for You

- Extend the Calculator to handle exponentiation (a ** b).
- Add a "remove task" option in the To-Do List App.
- Modify Word Counter to also count characters.
- Make Guess the Number keep running until the user guesses correctly.