0% found this document useful (0 votes)
6 views4 pages

Python Notes 1 20

notes for pythone

Uploaded by

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

Python Notes 1 20

notes for pythone

Uploaded by

zihad.ahmed001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Notes (1–20)

1
Introduction to Python

Python is a high-level, interpreted programming language. Easy to learn, widely used in AI,
ML, Web, etc.
বাংলায়: পাইথন একটি উচ্চস্তরের প্রোগ্রামিং ভাষা। এটি সহজে শেখা যায়।

2
Environment Setup

Steps: Install Python, Install IDE (PyCharm, VSCode, etc.), Set PATH variable.
বাংলায়: পাইথন ইনস্টল করতে হবে এবং একটি এডিটর ব্যবহার করতে হবে।

3
First Python Program

Example:
print("Hello World")
Output: Hello World

4
Backslash Characters and Comments

Examples:
\n = New Line, \t = Tab
# This is a comment

5
Variables and Data Types

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


Example:
x = 10 (int), name = "Zihad" (str)
6
Basic Numerical Operations

+ , - , * , / , // , % , **

7
Getting User Input

Example:
name = input("Enter your name: ")
print(name)

8
Type Casting

Example:
int("5") → 5
float("5.2") → 5.2

9
Area of Any Shape

Example:
Area of rectangle = l * w
Area of circle = πr²

10
Math Related Library Functions

Import math module:


from math import sqrt, pow, floor, ceil
Example:
sqrt(16) → 4.0
pow(2,3) → 8

11
Formatted String | type() function
Example:
name = "Zihad"; age = 20
print(f"My name is {name}, age {age}")

12
Relational Operator & Boolean

==, !=, >, <, >=, <= return True/False

13
if, else (Theory)

Decision making.

14
if, else (Practical)

Example:
x = 10
if x > 5: print("Big") else: print("Small")

15
elif Statement

Example:
x=10
if x>15: print("Big") elif x==10: print("Equal") else: print("Small")

16
Inner If Statement

Nested if inside another if.

17
Ternary Operator

Example:
a=5; b=10
print("A" if a<b else "B")

18
Logical Operators

and, or, not

19
Letter Grade Program

Example:
mark=85 → Grade A
if mark>=80: print("A")

20
while Loop

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

You might also like