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

Python Notes

This document provides an overview of Python programming, covering key concepts such as variables, data types, operators, conditional statements, loops, functions, and object-oriented programming. It also discusses exception handling, file handling, and the use of modules, along with a list of useful libraries for various applications. Additionally, it offers tips for beginners to enhance their coding skills.

Uploaded by

MOVIES MANIA
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 views3 pages

Python Notes

This document provides an overview of Python programming, covering key concepts such as variables, data types, operators, conditional statements, loops, functions, and object-oriented programming. It also discusses exception handling, file handling, and the use of modules, along with a list of useful libraries for various applications. Additionally, it offers tips for beginners to enhance their coding skills.

Uploaded by

MOVIES MANIA
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

Python Notes - Beginner to Intermediate

Introduction to Python

Python is a high-level, interpreted programming language known for readability and simplicity. It is widely used in web
development, data science, AI, automation, and software development.

Variables and Data Types

Variables: Store data values.


Example:
x = 10
name = "Gaurav"

Common Data Types:


int, float, str, bool, list, tuple, set, dict

Input and Output

name = input("Enter your name: ")


print("Hello", name)

Operators

Arithmetic: +, -, *, /, %
Comparison: ==, !=, >,
Logical: and, or, not

Conditional Statements

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

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 "Hello " + name

Lists

nums = [1, 2, 3]
[Link](4)
print(nums[0])

Tuples

tup = (1, 2, 3)
Tuples are immutable.

Dictionaries

student = {"name": "Gaurav", "age": 21}


print(student["name"])

Object-Oriented Programming

class Person:
def __init__(self, name):
[Link] = name

Exception Handling

try:
x = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero")

File Handling

file = open("[Link]", "r")


print([Link]())
[Link]()

Modules

import math
print([Link](25))

Useful Python Libraries

NumPy - Numerical Computing


Pandas - Data Analysis
Matplotlib - Visualization
Flask/Django - Web Development

Tips for Beginners

1. Practice coding daily.


2. Learn problem solving.
3. Build small projects.
4. Read error messages carefully.

You might also like