Python căn bản (1): Introduction

[Từ điển]

1. Python Introduction

1.1 What Is Python?

Python is a popular programming language. It was created by

Guido van Rossum, and released in 1991.

It is used for:

- web development (server-side),

- software development,

- mathematics,

- system scripting.

1.2 Python Install

To check if you have python installed on a Windows PC,

run the following on the Command Line (cmd.exe):

- Press Window key + R, to open the Run window

- Type cmd into the input box, press Enter

- In the command line, type python -- version

- If the version is displayed (eg, Python 3.9.2),

It means Python have installed

- If you find that you do not have Python installed on your computer,

then you can download it for free from the following website:

https://www.python.org/

1.3 The First Program

Let's write our first Python file, called helloworld.py, which can be done in

any text editor (eg, Notepad).

- Open the Run window, type notepad to open the Notepad 

- Type the Python’s command: 

print(“hi bac Teo”)

- Save the file named helloworld.py

- Open the command line, reach the folder where the helloworld.py

have saved, type python helloworld.py.

It means hi Python, please run the helloworld.py file.

- The output should read:

hi bac Teo

Congratulations, you have written and executed your first Python program.

1.4 Exercise

1. What is the correct file extension for Python files?

A. .pp

B. .pt

C. .ppt

D. .py

2. What is the correct command line syntax for checking if

Python is installed on your computer?

A. python ##version

B. python version

C. python --version

D. python ?version

----

Cập nhật: 28/8/2024

Bài sau: Python căn bản (2): Syntax

-----

Bạn muốn học Python căn bản tại Đà Lạt, liên hệ