Data Types
Data type is the important concept in all programming languages, the person who aimed to learn a particular programming language then the person should learn data types.
Python has the following data types built-in by default, in these categories:
Text Type | str |
Numeric Types | int, float, complex |
Sequence Type | list, tuple, range |
Mapping Type | dict |
Set Types | set, frozen set |
Boolean Types | bool |
Binary Type | bytes, bytearray, memoryview |
Getting Data Type:
You can find a data type of your variable by using type() function:
Example Program:
a=10
b="Let's Update"
print(type(a))
print(type(b))
Output: <class 'int'>
<class 'str'>
Declare a data type.
In python We Don't Need To Declare A data type,
when we assign a value it will set by default.
Example | Data Type | |
---|---|---|
x = "Hello World" | str | |
x = 20 | int | |
x = 20.5 | float | |
x = 1j | complex | |
x = ["apple", "banana", "cherry"] | list | |
x = ("apple", "banana", "cherry") | tuple | |
x = range(6) | range | |
x = {"name" : "John", "age" : 36} | dict | |
x = {"apple", "banana", "cherry"} | set | |
x = frozenset({"apple", "banana", "cherry"}) | frozenset | |
x = True | bool | |
x = b"Hello" | bytes | |
x = bytearray(5) | bytearray | |
x = memoryview(bytes(5)) | memoryview |
1 Comments
How to Make Money from Betting on Sports Betting - Work
ReplyDelete(don't worry if ventureberg.com/ you get it wrong, though) The process involves placing https://sol.edu.kg/ bets on different 토토사이트 events, but หาเงินออนไลน์ it novcasino can also be done by using the