environment windows7 (I want a Mac Book Pro 16inch) Visual Studio Code chrome
This article is written for beginners in programming and Python.
integer 1 123 -1234
Etc. (integer). It includes both plus and minus.
style.py
print(type(1))
#<class 'int'>"It's an integer," he says.
print(type(123))
#<class 'int'>This is also an "integer"
print(type(-1234))
#<class 'int'>Even if it's negative, it's an integer.
string Hello Hello Python I'll be back Comment allez-vous? There are already many coronas
Etc. (character string).
type.py
print(type("Hello"))
#<class 'str'>Take the first three of string'str'.. In other words, it is a character (character string).
print(type("Hello Python"))
#<class 'str'>This is also a character string.
print(type("Comment allez-vous?"))
#<class 'str'>Even in French, "It's a character string"
print(type("There are already many coronas"))
#<class 'str'>The virus is also a "character string"
floating point numbers 1.0 -3.14
Decimal point (floating point number * 1)
type.py
print(type(1.0))
#<class 'float'>Take the 5 acronyms for floating point'float'.. In other words, it is a decimal point (floating point number).
print(type(-3.14))
#<class 'float'>Even if it is negative, it is a decimal point (floating point number).
complex numbers 3j 3.21j
Imaginary number. what the hell! When I try to google, here is difficult to understand, but it is written in an easy-to-understand manner.
type.py
print(type(3j))
# <class 'complex'>"Hey, it's an imaginary number!"
print(type(3.21j))
# <class 'complex'>"It's not Kyo on Hachijojima ... but an imaginary number."
boolean True (T is uppercase) Fals (F is uppercase) Fortunately, there are only two types of booleans. "I write Boolean and say Boolean."
type.py
print(type(True))
# <class 'bool'>"I'm a Boolean"
print(type(False))
# <class 'bool'>"I'm Takagi Boolean."
***
Recommended Posts