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

Python Basics Notes

Uploaded by

hak.nirob
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)
8 views3 pages

Python Basics Notes

Uploaded by

hak.nirob
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/ 3

Python Basics: Variables, Data Types, and Operators

Variables

- Used to store data (e.g., x = 5)

- No type declaration needed.

- Naming Rules:

- Starts with letter or underscore

- Cannot start with number

- Case-sensitive

Data Types

- int: 5, -3

- float: 3.14, -0.1

- str: "Hello"

- bool: True, False

- list: [1, 2, 3]

- tuple: (1, 2)

- dict: {"a": 1}

Type Casting

- int("10") -> 10

- str(5.6) -> "5.6"

- float("2.5") -> 2.5

Operators

1. Arithmetic
+ - * / % // **

Examples:

-2+3=5

- 5 / 2 = 2.5

- 5 // 2 = 2

-5%2=1

- 2 ** 3 = 8

2. Comparison: == != > < >= <=

3. Assignment: = += -= *= /= //=

4. Logical: and or not

5. Membership: in not in

Mind Map

Python Basics

- Variables

- Naming rules

- Dynamic typing

- Data Types

- int, float, str, bool

- list, tuple, dict

- type(), isinstance()

- Operators

- Arithmetic: + - * / // % **

- Comparison: == != > < >= <=

- Assignment: = += -=
- Logical: and, or, not

- Membership: in, not in

- Type Casting

- int(), float(), str()

You might also like