0% found this document useful (0 votes)
3 views9 pages

Complete Python Course

This document provides comprehensive notes on Python programming, covering topics from basics to advanced concepts including syntax, data types, control flow, functions, and object-oriented programming. It also includes practical examples, installation instructions, and project ideas to enhance learning. The final notes emphasize the importance of practice and exploration of various frameworks based on individual interests.

Uploaded by

teen22645471
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

Complete Python Course

This document provides comprehensive notes on Python programming, covering topics from basics to advanced concepts including syntax, data types, control flow, functions, and object-oriented programming. It also includes practical examples, installation instructions, and project ideas to enhance learning. The final notes emphasize the importance of practice and exploration of various frameworks based on individual interests.

Uploaded by

teen22645471
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

📘 Complete Python Course Notes (Beginner to Advanced)

🔰 Module 1: Python Basics

🔹 What is Python?

Python is a high-level, interpreted, general-purpose programming language known for its readability and
simplicity. It supports multiple programming paradigms such as procedural, object-oriented, and functional
programming.

Key Features:

• Easy to learn and use: Python has simple and clean syntax, making it easy for beginners to start
coding.
• Interpreted language: Python code runs line-by-line without compilation.
• Dynamically typed: No need to declare data types, Python understands them during execution.
• Large standard library: Comes with many built-in modules and packages.
• Open-source and community-driven: Free to use with a vast support community.
• Portable: Can run on different operating systems without modification.

🔹 Installing Python

1. Visit the official Python website: https://www.python.org


2. Download the latest version suitable for your OS.
3. During installation, select "Add Python to PATH".
4. Use IDEs like VSCode, PyCharm, Thonny, or Jupyter for development.

🔹 First Python Program

print("Hello, World!")

• print() is a function that displays the given message on the screen.

🔹 Python Syntax

• Python uses indentation (whitespace at the beginning of a line) to define blocks of code.
• Avoid using {} like in C/C++ or Java.

🔹 Variables and Data Types

Variables are used to store data. You don’t need to specify the type.

name = "Teja" # String


iq = 140 # Integer

1
pi = 3.14 # Float
is_clever = True # Boolean

🔹 Comments

• Single-line: # This is a comment


• Multi-line:

"""
This is a
multi-line comment
"""

• Comments are ignored during execution and help document the code.

🔹 Type Casting

Convert data from one type to another.

x = int("10") # string to integer


y = float("10.5")
z = str(20) # integer to string

🔹 Input from User

name = input("Enter your name: ")


print("Hello,", name)

• input() takes user input as a string.

🔹 Print with Formatting

name = "Teja"
age = 20
print(f"My name is {name} and I am {age} years old.")

• The f before the string allows f-string formatting.

2
🔢 Module 2: Operators & Expressions

🔹 Types of Operators

• Arithmetic Operators: Used for basic math ( + , - , * , / , % , ** , // )


• Comparison Operators: Compare values ( == , != , > , < , >= , <= )
• Logical Operators: Combine conditions ( and , or , not )
• Assignment Operators: Assign values with operations ( = , += , -= ...)
• Bitwise Operators: Work at bit level ( & , | , ^ , ~ , << , >> )
• Membership Operators: Check membership ( in , not in )
• Identity Operators: Compare memory location ( is , is not )

🔹 Examples

a = 10
b = 3
print(a + b) # 13
print(a ** b) # 1000
print(a > 5 and b < 5) # True

🔁 Module 3: Control Flow

🔹 if, elif, else

Conditional branching to execute blocks based on conditions.

x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")

🔹 Loops

Used to execute blocks repeatedly.

3
for loop

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

• Repeats code for a sequence of values (0 to 4).

while loop

i = 0
while i < 5:
print(i)
i += 1

• Repeats while condition is true.

break, continue, pass

for i in range(10):
if i == 5:
break
if i % 2 == 0:
continue
print(i)

• break : exit loop


• continue : skip current iteration
• pass : placeholder for future code

📦 Module 4: Data Structures

🔹 List

An ordered, mutable collection.

fruits = ["apple", "banana"]


fruits.append("cherry")
print(fruits)

🔹 Tuple

An ordered, immutable collection.

4
t = (1, 2, 3)
print(t[1])

🔹 Set

An unordered collection of unique items.

s = {1, 2, 2, 3}
print(s) # {1, 2, 3}

🔹 Dictionary

Key-value pairs.

person = {"name": "Teja", "age": 20}


print(person["name"])

🔹 String Operations

Manipulating string data.

s = "Hello World"
print(s.upper())
print(s[0:5])

🎯 Module 5: Functions

🔹 Defining and Calling Functions

Reusable block of code.

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

print(greet("Teja"))

🔹 Lambda Functions

Short anonymous functions.

5
square = lambda x: x ** 2
print(square(4))

🔹 *args and **kwargs

Handle variable arguments.

def test(*args, **kwargs):


print(args)
print(kwargs)

test(1, 2, 3, name="Teja")

🎲 Module 6: Object-Oriented Programming

🔹 Classes and Objects

OOP helps structure code logically.

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

def show(self):
print(self.name, self.age)

s = Student("Teja", 20)
s.show()

🔹 Inheritance

One class inherits from another.

class A:
def display(self):
print("Class A")

class B(A):
pass

6
obj = B()
obj.display()

🚫 Module 7: Exception Handling


Prevent program crashes by catching errors.

try:
a = int(input("Enter a number: "))
print(10 / a)
except ZeroDivisionError:
print("Cannot divide by zero")
except ValueError:
print("Invalid input")
finally:
print("Done")

📂 Module 8: File Handling


Read and write to files.

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


f.write("Hello World")

with open("file.txt", "r") as f:


print(f.read())

🧰 Module 9: Modules & Libraries


Use existing Python code.

import math
print(math.sqrt(16))

import random
print(random.randint(1, 10))

7
🔧 Module 10: Advanced Python

🔹 List Comprehension

Short way to create lists.

squares = [x**2 for x in range(10)]

🔹 Generators

Functions that yield values lazily.

def gen():
for i in range(5):
yield i

🔹 Decorators

Wrap another function to add behavior.

def decorator(func):
def wrapper():
print("Before function")
func()
print("After function")
return wrapper

@decorator
def say_hi():
print("Hi")

say_hi()

💡 Module 11: Project Ideas


• Calculator: Perform basic arithmetic
• To-Do CLI App: Manage tasks from terminal
• Weather App using API: Fetch weather using API
• GUI Quiz App using Tkinter: Build quiz with buttons
• Data Analysis using Pandas: Work with real-world data

8
🧠 Final Notes
Python is a versatile language. Practice regularly, build projects, and explore frameworks like Flask, Django,
Pandas, NumPy, and TensorFlow depending on your interests (web, data science, ML, etc.).

Stay consistent, solve problems daily, and keep challenging yourself!

You might also like