0% found this document useful (0 votes)
15 views15 pages

AKTU Python 4thsem Complete Notes ReportLab

The document provides comprehensive notes on Python programming for the 4th semester, covering topics from basic syntax and data types to advanced concepts like object-oriented programming and libraries such as Numpy and Matplotlib. Each chapter includes essential features, examples, and code snippets to illustrate key concepts. It serves as a complete guide for students learning Python in both Hindi and English.
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)
15 views15 pages

AKTU Python 4thsem Complete Notes ReportLab

The document provides comprehensive notes on Python programming for the 4th semester, covering topics from basic syntax and data types to advanced concepts like object-oriented programming and libraries such as Numpy and Matplotlib. Each chapter includes essential features, examples, and code snippets to illustrate key concepts. It serves as a complete guide for students learning Python in both Hindi and English.
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/ 15

AKTU Python 4th Sem – Complete Notes (Hindi + English)

Chapter 1: Introduction to Python


Python ek high-level, interpreted programming language hai jo easy syntax ke liye famous hai.
Features: open-source, portable, dynamic typing, large libraries.
Use cases: web dev, AI, data science, automation.
Installation: Python.org se download karo, IDE: IDLE, VS Code etc.
Chapter 2: Variables and Data Types
Variables me data store hota hai. Python me types: int, float, str, bool, list, tuple, dict, set.
Example:
x = 5 # int
name = 'Parv' # string
Type casting: int('5')
Input: name = input('Enter your name: ')
Output: print('Hello', name)
Chapter 3: Operators
1. Arithmetic: +, -, *, /, %, **
2. Relational: ==, !=, >, <
3. Logical: and, or, not
4. Assignment: =, +=, -=
5. Identity: is, is not
6. Membership: in, not in
7. Bitwise: &, |, ^, ~, <<, >>
Chapter 4: Control Statements
if condition:
# true block
else:
# false block
Loops:
for i in range(5):
print(i)
while condition:
# loop
Use break, continue, pass inside loops.
Chapter 5: Functions
Function define karne ke liye def use hota hai.
def greet(name):
return 'Hello ' + name
Lambda function: square = lambda x: x*x
Recursion: jab function khud ko call kare.
Chapter 6: Strings
String immutable hote hain. Use + for concat, * for repetition.
Methods: upper(), lower(), strip(), find(), replace(), split()
Slicing: s[1:4], s[-1], s[::-1]
Chapter 7: Lists and Tuples
List: ordered, mutable
x = [1, 2, 3]
x.append(4), x.remove(2)
Tuple: ordered, immutable
t = (1, 2, 3)
Chapter 8: Dictionaries and Sets
Dict: key-value pairs
d = {'a': 1, 'b': 2}
Access: d['a']
Set: unordered, unique items
s = {1, 2, 3}, s.add(4)
Chapter 9: File Handling
f = open('data.txt', 'r')
content = f.read()
f.close()
with open('data.txt', 'w') as f:
f.write('Hello')
Chapter 10: Exception Handling
try:
x = int(input())
except ValueError:
print('Invalid input')
finally:
print('Done')
Chapter 11: Object-Oriented Programming
class Student:
def __init__(self, name):
self.name = name
def show(self):
print('Name:', self.name)
s = Student('Parv')
s.show()
Chapter 12: Modules and Packages
import math
print(math.sqrt(16))
Custom module: create .py file and import it.
pip install package_name
Chapter 13: Numpy Introduction
import numpy as np
a = np.array([1,2,3])
a.shape, a.reshape(), a[1:3]
Chapter 14: Matplotlib Basics
import matplotlib.pyplot as plt
x = [1,2,3]; y = [2,4,6]
plt.plot(x, y)
plt.title('Graph'); plt.show()
Chapter 15: Most Repeated Programs
1. Factorial
n = 5; fact = 1
for i in range(1, n+1): fact *= i
print('Factorial:', fact)
2. Palindrome
s = 'madam'; print(s == s[::-1])
3. Prime check
num = 7
if num > 1:
for i in range(2, num):
if num % i == 0: print('Not Prime'); break
else: print('Prime')

You might also like