0% found this document useful (0 votes)
12 views12 pages

SEED

This document provides comprehensive notes on Python, covering its introduction, history, features, installation, syntax, data types, operators, control statements, loops, functions, data structures, string operations, file handling, exception handling, and object-oriented programming. It highlights Python's versatility in applications such as web development, data science, and artificial intelligence. The notes conclude with an emphasis on Python's popularity due to its simplicity and power.

Uploaded by

Anub A Nair
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)
12 views12 pages

SEED

This document provides comprehensive notes on Python, covering its introduction, history, features, installation, syntax, data types, operators, control statements, loops, functions, data structures, string operations, file handling, exception handling, and object-oriented programming. It highlights Python's versatility in applications such as web development, data science, and artificial intelligence. The notes conclude with an emphasis on Python's popularity due to its simplicity and power.

Uploaded by

Anub A Nair
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

Here are simple Python notes written clearly for study.

PYTHON NOTES
1. Introduction to Python
Python is a high-level programming language used for web development, data science,
artificial intelligence, automation, and software development.
It is easy to learn because its syntax is simple and readable.
Example:
print("Hello World")

2. History of Python
Python was created by Guido van Rossum and released in 1991.
It was designed to make programming simple and powerful.

3. Features of Python
Main features of Python:
• Easy to learn
• Simple syntax
• Open source
• Platform independent
• Object-oriented
• Large library support

4. Installing Python
Steps to install Python:
1. Go to the official website of Python
2. Download the latest version
3. Install it on your computer
4. Open Python IDLE or command prompt
Check installation:
python --version

PYTHON BASICS
5. Python Syntax
Python uses indentation instead of braces.
Example:
if 5 > 2:
print("Five is greater than two")

6. Variables in Python
Variables store data.
Example:
x = 10
name = "John"
Rules:
• Must start with a letter or underscore
• Cannot start with a number
7. Data Types
Common Python data types:
Data Type Example

Integer 10

Float 3.14

String "Hello"

Boolean True

List [1,2,3]

Tuple (1,2,3)

Dictionary {"name":"John"}
Example:
x = 10
y = 3.5
name = "Python"

8. Type Conversion
Changing one data type to another.
Example:
x = int(5.6)
y = str(10)
OPERATORS
9. Arithmetic Operators
Operator Example

+ Addition

- Subtraction

* Multiplication

/ Division

% Modulus
Example:
a = 10
b=5
print(a + b)

10. Comparison Operators


Operator Meaning

== Equal

!= Not equal

> Greater

< Less
Example:
print(5 > 3)
CONTROL STATEMENTS
11. If Statement
Example:
age = 18

if age >= 18:


print("You can vote")

12. If-Else Statement


num = 5

if num % 2 == 0:
print("Even")
else:
print("Odd")

13. Nested If
x = 10

if x > 5:
if x < 20:
print("Number is between 5 and 20")
LOOPS
14. For Loop
Used to repeat code.
for i in range(5):
print(i)
Output:
0
1
2
3
4

15. While Loop


i=1

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

16. Break and Continue


Break example:
for i in range(10):
if i == 5:
break
print(i)
Continue example:
for i in range(5):
if i == 2:
continue
print(i)

FUNCTIONS
17. Functions in Python
Functions are reusable blocks of code.
def greet():
print("Hello")
Call function:
greet()

18. Function with Parameters


def add(a, b):
print(a + b)

add(5,3)

19. Lambda Function


Small anonymous function.
square = lambda x: x*x
print(square(5))

DATA STRUCTURES
20. Lists
Lists store multiple values.
numbers = [1,2,3,4]
print(numbers[0])
Features:
• Ordered
• Changeable
• Allows duplicates

21. Tuples
Tuples are similar to lists but cannot be changed.
numbers = (1,2,3)

22. Sets
Sets do not allow duplicate values.
numbers = {1,2,3}

23. Dictionaries
Store data in key-value pairs.
student = {
"name": "John",
"age": 20
}

print(student["name"])

STRINGS
24. String Operations
Example:
text = "Python"

print([Link]())
print(len(text))

FILE HANDLING
25. Reading a File
file = open("[Link]","r")
print([Link]())
[Link]()

26. Writing a File


file = open("[Link]","w")
[Link]("Hello Python")
[Link]()

EXCEPTION HANDLING
27. Try and Except
try:
x = 10/0
except:
print("Error occurred")

OBJECT ORIENTED PROGRAMMING


28. Class and Object
class Student:
name = "John"

s1 = Student()
print([Link])

29. Python Libraries


Python has many libraries:
• NumPy – numerical computing
• Pandas – data analysis
• Matplotlib – graphs

30. Applications of Python


Python is used for:
• Web development
• Artificial Intelligence
• Machine Learning
• Data Science
• Automation
• Game development

✅ Conclusion:
Python is one of the most popular programming languages because it is simple, powerful,
and versatile.

If you want, I can also make:


• 📘 50-page Python notes

• 🧠 Python notes for exams

• 💻 Python programs list (100 programs for practice).


ATTENDANCE
Academic Year 2024-25 ODD Program [Link] CSE Engineering
Batch CSE 2024-2028 Semester S1
Course Code UCEST105 Course Name ALGORITHMIC THINKING WITH PYTHON
Faculty Name Anub A Department of Faculty CSE

You might also like