I've been away from programming for a long time, so I actually tried running Python's super beginner code for practice and revenge.
The experience of actually running the program is left as a memorandum. I hope it helps someone.
Variables do not need to be declared in advance in Python, but variables can be declared. It is not necessary, but it is used when you need to improve readability.
#integer type
num: int = 1
#string type
text: str = '1'
#boolean type
isEnabled: bool = True
--Alphabet (lowercase) --Alphabet (uppercase) --Numbers
--You can't use anything that starts with a number
Python does not require variable declaration (type specification). To check what type is set, use the type () function to get / check the type of the object.
num: int = 1
print(num , type(num))
#1 <class 'int'>
text: str = '1'
print(text, type(text))
#1 <class 'str'>
isEnabled: bool = True
print(isEnabled , type(isEnabled))
#True <class 'bool'>
Recommended Posts