This is a python introduction for beginners, this post will show you some ways to code and run in the python environment.
How to install python?
First, download Visual Studio Code, then click extension and type: Python. Next, install it.
Create a file with “.py” like the image below, then press the ‘Enter’ Keyboard or click outside the input box:
Click the run on the right top whenever you finish your code (I circle it)
How to display?
Create a variable and assign it with a number then display it.
The “a” variable can get string, int, float,…
- a = 1 -> the variable becomes an integer variable.
- a = 1,2: a float variable.
- a = “Hello everyone”: a string variable.
To display the variable, you need to convert it to a string like str(a) (except with the variable can assign with string)
Math in python
The variable USD equals 1, and then that variable is multiplied by 22. When it is displayed, you must convert the type to string to display.
Input, assign variable then display
Subscribe to our email newsletter to get the latest posts delivered right to your email.