Skip to content

Commit 65ec9a0

Browse files
Add files via upload
1 parent 5023a14 commit 65ec9a0

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

week_2/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Python Built-in Data Types
2+
3+
In programming, data types are crucial because they define the kind of data a variable can store and how it can be used. Python has several built-in data types that are categorized as follows:
4+
5+
## Text Type
6+
- **`str`**: Represents a string of characters.
7+
8+
## Numeric Types
9+
- **`int`**: Represents integer numbers.
10+
- **`float`**: Represents floating-point numbers (decimals).
11+
- **`complex`**: Represents complex numbers (numbers with a real and imaginary part).
12+
13+
## Sequence Types
14+
- **`list`**: An ordered, mutable collection of items.
15+
- **`tuple`**: An ordered, immutable collection of items.
16+
- **`range`**: Represents a sequence of numbers, often used in loops.
17+
18+
## Mapping Type
19+
- **`dict`**: A collection of key-value pairs (dictionary).
20+
21+
## Set Types
22+
- **`set`**: An unordered collection of unique items.
23+
- **`frozenset`**: An immutable version of a set.
24+
25+
## Boolean Type
26+
- **`bool`**: Represents boolean values `True` or `False`.
27+
28+
## Binary Types
29+
- **`bytes`**: Immutable sequence of bytes.
30+
- **`bytearray`**: Mutable sequence of bytes.
31+
- **`memoryview`**: A view object that exposes an array's buffer interface.
32+
33+
## None Type
34+
- **`NoneType`**: Represents the absence of a value or a null value.
35+
36+
## Getting the Data Type
37+
38+
You can find out the data type of any object by using the `type()` function:
39+
40+
```python
41+
x = 5
42+
print(type(x)) # Output: <class 'int'>

week_2/leacture 03.pptx

987 KB
Binary file not shown.

week_2/third.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
a=10
2+
print(a) #10
3+
print(type(a)) #int
4+
5+
b=10.0
6+
print(a) #10.0
7+
print(type(a)) #float
8+
9+
c="Fahad Ahmed"
10+
print(a) #Fahad Ahmed
11+
print(type(a)) #String
12+
13+
a=True
14+
print(a) #True
15+
print(type(a)) #Bool
16+

0 commit comments

Comments
 (0)