Data types
In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:
- Text Type:
str
- Numeric Types:
int
,float
,complex
- Sequence Types:
list
,tuple
,range
- Mapping Type:
dict
- Set Types:
set
,frozenset
- Boolean Type:
bool
- Binary Types:
bytes
,bytearray
,memoryview
Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.
If you have a variable which you want to check its type, use the type()
function. Do not forget to use the print
function, so Python will print the result for us. For example,
1234# create some variable var = (1,2) # check variable type print(type(var))
Swipe to start coding
Check the types of variables days
and sec_in_hour
, defined in the code.
Lösning
Tack för dina kommentarer!
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 2.33Awesome!
Completion rate improved to 2.33
Data types
In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:
- Text Type:
str
- Numeric Types:
int
,float
,complex
- Sequence Types:
list
,tuple
,range
- Mapping Type:
dict
- Set Types:
set
,frozenset
- Boolean Type:
bool
- Binary Types:
bytes
,bytearray
,memoryview
Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.
If you have a variable which you want to check its type, use the type()
function. Do not forget to use the print
function, so Python will print the result for us. For example,
1234# create some variable var = (1,2) # check variable type print(type(var))
Swipe to start coding
Check the types of variables days
and sec_in_hour
, defined in the code.
Lösning
Tack för dina kommentarer!
single
Awesome!
Completion rate improved to 2.33
Data types
Svep för att visa menyn
In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:
- Text Type:
str
- Numeric Types:
int
,float
,complex
- Sequence Types:
list
,tuple
,range
- Mapping Type:
dict
- Set Types:
set
,frozenset
- Boolean Type:
bool
- Binary Types:
bytes
,bytearray
,memoryview
Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.
If you have a variable which you want to check its type, use the type()
function. Do not forget to use the print
function, so Python will print the result for us. For example,
1234# create some variable var = (1,2) # check variable type print(type(var))
Swipe to start coding
Check the types of variables days
and sec_in_hour
, defined in the code.
Lösning
Tack för dina kommentarer!