Python Tutorial 2: The First Python Program

Python Tutorial 2: The First Python Program

Target

  • first HelloPythonprogram
  • Introduction to Python 2.xand 3.xversions
  • Three ways to execute Python programs
    – Interpreter – python/python3
    – Interactive – ipython
    – Integrated development environment –Pycharm

1. The first HelloPython program

1.1 Basic concepts of Python source program

  1. The Python source program is a text file in a special format that can be developed using any text editing softwarePython .
  2. The file extension for Python programs is usually .py.

1.2 Exercise steps

Create a new file under the folder 01-HelloPython.pyand use the editor to enter the following content

print("Hello Python")
print("Hello World")

Open cmd, locate the path where the file is located, and enter python 01-HelloPython.pyto view the running results:
Insert image description here

printis pythonthe first function in

printThe function of the function can output the content inside "" to the screen.

Guess you like

Origin blog.csdn.net/WwLK123/article/details/131832289