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.

Visual Studio Code – download

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)

Can you see the circle above

Let’s Coding

How to display?

It shows: “123” & “Hello world in Python”

Create a variable and assign it with a number then display it.

The “a” variable can get string, int, float,…

Like:

  • 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)

It shows: “1”

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.

Display “1” and “22” and assign them to other strings.

Input, assign variable then display

Input the number you want to display the final result.

Categorized in: