What beginners learned from the basics of variables in python

It's my first time to write something like an article, so it may be difficult to see or understand, but please understand that I will continue to devote myself.

What I learned from the basics of variables in python

Data type declaration

Unlike java, variables can be defined with num = 1`` str =" aaa " instead of int num = 1 or String str =" aaa "

data = 1 data ="aaa" print(data)

Even if you put a character string after putting an integer like the above in a variable, it works without problems. Do I need to be careful when handling data as it seems to work somehow if I'm not careful? ??

How to check the type

There is a type () function in the way to check the type of data

num = 1 num2 = 1.5 str ="aaa" listData = [0,1,2] print(type(num)) print(type(num2)) print(type(str)) print(type(listData)) #=> <class 'int'> #=> <class 'float'> #=> <class 'str'>
#=> <class 'list'>

Addendum: I would like to investigate both java and python on my own, including the content that you commented on the detailed content of the data type.

Recommended Posts

What beginners learned from the basics of variables in python
Learn the basics of Python ① Beginners
The basics of running NoxPlayer in Python
What I learned in Python
[Example of Python improvement] I learned the basics of Python on a free site in 2 weeks.
Existence from the viewpoint of Python
What I thought about in the entrance exam question of "Bayesian statistics from the basics"
Review of the basics of Python (FizzBuzz)
About the basics list of Python basics
[Super basics of Python] I learned the basics of the basics, so I summarized it briefly.
Learn the basics while touching python Variables
Learning notes from the beginning of Python 1
I didn't know the basics of Python
The result of installing python in Anaconda
What is "mahjong" in the Python library? ??
[python] Checking the memory consumption of variables
The story of manipulating python global variables
In search of the fastest FizzBuzz in Python
Learning notes from the beginning of Python 2
Mathematical statistics from the basics Random variables
[Python3] Understand the basics of file operations
Basics of Python ①
Basics of python ①
What kind of book is the best-selling "Python Crash Course" in the world?
Get the contents of git diff from python
Output the number of CPU cores in Python
[Python] Sort the list of pathlib.Path in natural sort
Python variables and data types learned in chemoinformatics
Get the caller of a function in Python
Match the distribution of each group in Python
What is wheezy in the Docker Python image?
Make a copy of the list in Python
Find the divisor of the value entered in python
Basics of computational complexity improvement learned from ABC163C
Find the solution of the nth-order equation in python
The story of reading HSPICE data in Python
[Note] About the role of underscore "_" in Python
Solving the equation of motion in Python (odeint)
Output in the form of a python array
About bit full search that often appears in competition pros From the eyes of beginners with python
Basic story of inheritance in Python (for beginners)
Access the variables defined in the script from the REPL
You will be an engineer in 100 days --Day 33 --Python --Basics of the Python language 8
You will be an engineer in 100 days --Day 26 --Python --Basics of the Python language 3
Deep Learning from scratch The theory and implementation of deep learning learned with Python Chapter 3
You will be an engineer in 100 days --Day 28 --Python --Basics of the Python language 4
Basics of Python scraping basics
the zen of Python
Basics of python: Output
python beginners tried to predict the number of criminals
Experience the good calculation efficiency of vectorization in Python
The wall of changing the Django service from Python 2.7 to Python 3
Used from the introduction of Node.js in WSL environment
Operate mongoDB from python in ubuntu environment ① Introduction of mongoDB
Basics of I / O screen using tkinter in python3
How to get the number of digits in Python
Learn Nim with Python (from the beginning of the year).
Output the time from the time the program was started in python
The idea of Tensorflow learned from potato chip manufacturing
[python] Get the list of classes defined in the module
Let's break down the basics of TensorFlow Python code