List of Python code to move and remember

About this article

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.

Variable declaration

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

Characters that can be used in variable names

--Alphabet (lowercase) --Alphabet (uppercase) --Numbers

Variable name rules

--You can't use anything that starts with a number

How to check the type

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

List of Python code to move and remember
Summary of how to use Python list
[Introduction to Udemy Python 3 + Application] 19. Copy of list
Python code to train and test with Custom Vision of Cognitive Service
List of main probability distributions used in machine learning and statistics and code in python
Mayungo's Python Learning Note: List of stories and links
List of posts related to optimization by Python to docker
List of Python libraries for data scientists and data engineers
How to write a list / dictionary type of Python3
List of Python code used in big data analysis
[Python] How to sort dict in list and instance in list
Summary of Python3 list operations
[Python] Convert list to Pandas [Pandas]
[Python] How to use list 1
2.x, 3.x character code of python
[Python] Copy of multidimensional list
[Introduction to Python] <list> [edit: 2020/02/22]
Python list and tuples and commas
Python list comprehensions and generators
Source installation and installation of Python
Convert python 3.x code to python 2.x
Try to get the function list of Python> os package
[python] Summary of how to retrieve lists and dictionary elements
How to shuffle a part of a Python list (at random.shuffle)
[Python] Summary of how to use split and join functions
Useful tricks related to list and for statements in Python
Decrypt one line of code in Python lambda, map, list
[Introduction to Data Scientists] Basics of Python ♬ Functions and classes
The process of making Python code object-oriented and improving it
Python: Create a dictionary from a list of keys and values
I want to know the features of Python and pip
List of libraries to install when installing Python using Pyenv
Go language to see and remember Part 8 Call GO language from Python
[Python3] List of sites that I referred to when I started Python
PyArmor ~ Easy way to encrypt and deliver python source code ~
Overview of Python virtual environment and how to create it
Spit out a list of file name, last modified date and character code in python3
[Python] How to delete rows and columns in a table (list of drop method options)
Environment construction of python and opencv
The story of Python and the story of NaN
Python 3.6 on Windows ... and to Xamarin.
Difference between list () and [] in Python
Installation of SciPy and matplotlib (Python)
[Introduction to Python3 Day 1] Programming and Python
Convert list to DataFrame with python
[Code] Module and Python version output
Check and move directories in Python
Python> list> Convert double list to single list
This and that of python properties
[Python] How to use list 3 Added
Useful to remember! 10 Python Standard Libraries
Python logging and dump to json
Selenium and python to open google
Coexistence of Python2 and 3 with CircleCI (1.0)
About the basics list of Python basics
Summary of Python indexes and slices
Reputation of Python books and reference books
Operate Jupyter with REST API to extract and save Python code
Python --Most elegant way to read lines of file into list
Python> list> append () and extend ()> append: list is added | extend: list elements are added | + = to add list
Try to get a list of breaking news threads in Python.