DEV Community

Sarvar12345
Sarvar12345

Posted on

Data types 2.0

                       Mapping type
Enter fullscreen mode Exit fullscreen mode

Mapping type - dict
1.1.Misol:
dict:x = {"name" : "John", "age" : 36}

1.2.ekranga chiqarish - display x:
print(x)

1.3.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))
Set types
set types - set and frozenset
2.1.set:x = {"apple", "banana", "cherry"}

2.2.ekranga chiqarish - display x:
print(x)

2.3.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))

2.4.frozenset:x = frozenset({"apple", "banana", "cherry"})

2.5.ekranga chiqarish - display x:
print(x)

2.6.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))
Boolesn type
Boolesn type - bool
3.1.x = True

3.2.ekranga chiqarish - display x:
print(x)

3.3.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))
Binary types
Binary types - bytes,bytearray, memoryview
4.1.bytes:x = b"Hello"

4.2.ekranga chiqarish - display x:
print(x)

4.3.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))

4.5.bytearray:x = bytearray(5)

4.6.ekranga chiqarish - display x:
print(x)

4.7.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))

4.8.memoryview:x = memoryview(bytes(5))

4.9.ekranga chiqarish - display x:
print(x)

4.10.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))

                   None type
Enter fullscreen mode Exit fullscreen mode

None type - None
5.1.None:x = None

5.2.ekranga chiqarish - display x:
print(x)

5.3.ekranga qanday turdaligini chiqarish - display the data type of x:
print(type(x))

Latest comments (0)