Python3 from introduction and environment to the first entry program


foreword

In order to consolidate the knowledge learned, the author tried to start publishing some blogs of learning notes for future review. Of course, it would be great if it could help some newcomers learn new technologies. The author is a piece of food. If there are any mistakes in the records in the article, readers and friends are welcome to criticize and correct.
(The reference source code of the blog can be found in the resources on my homepage. If you have any questions during the learning process, please feel free to ask me in the comment area)

1. Introduction to Python3

1. what is python

  • Python is a high-level scripting language that combines interpretability, compilation, interactivity and object-oriented

  • Python is designed to be highly readable . Compared with other languages, it often uses English keywords and some punctuation marks in other languages. It has a more distinctive grammatical structure than other languages.

  • Python is an interpreted language : this means that there is no compilation part of the development process. Languages ​​similar to PHP and Perl

  • Python is an interactive language : this means that you can execute code directly after a Python prompt >>>

  • Python is an object-oriented language : This means that Python supports an object-oriented style or programming technique in which code is encapsulated in objects

  • Python is a Beginner's Language : Python is a great language for beginning programmers and supports a wide range of application development, from simple word processing to WWW browsers to games

  • Due to its exceptional readability and simplicity, Python is the language of choice in data science , web development , artificial intelligence , and automation

2. The development history of python

  • The development history of Python can be traced back to the late 1980s. The following are some important development nodes of Python :
  1. 1989: Guido van Rossum started writing the Python language during the Christmas break and released the first Python version, Python 0.9.0, the following year
  2. 1991: The first public release of Python, Python 0.9.1, is released. This marks Python as an official programming language
  3. 1994: Python 1.0 is officially released, introducing some important new features such as exception handling and the module system
  4. 2000: Python 2.0 is released, introducing important improvements, including garbage collection and list comprehensions
  5. 2008 : Python 3.0 (also known as Python 3000 or simply Python 3) is released. This is a major version upgrade, introducing many incompatible syntax and library changes to improve language consistency and clarity
  • Since the release of Python 3, the Python community has gradually abandoned Python 2 and focused on the development and promotion of Python 3. The release of Python 3.0 faced some compatibility challenges, but over time developers adapted to the new syntax and features
  • Each minor release (such as 3.1, 3.2, 3.3, etc.) after the Python 3.0 release introduced improvements and new features to enhance the functionality and performance of Python. The Python community actively develops various third-party libraries and tools, expanding the application areas of Python and making it a widely used programming language
  • Today, Python is still evolving and has come a long way. Versions such as Python 3.9 and Python 3.10 were released one after another, introducing more improvements and enhancements. The Python community is still active and continues to promote the progress and development of Python

3. The characteristics of python

  • Ease of learning : Python has relatively few keywords, a simple structure, and a well-defined syntax, making it easier to learn.

  • Ease of reading : Python code is more clearly defined.

  • Easy to maintain : Python's success lies in its source code is quite easy to maintain.

  • An extensive standard library : One of Python's greatest strengths is its rich library, which is cross-platform and works well on UNIX, Windows, and Macintosh.

  • Interactive mode : Supported by interactive mode, you can input the language from the terminal to execute the code and get the result, interactive test and debug code fragments.

  • Portability : Due to its open source nature, Python has been ported (that is, made to work) to many platforms.

  • Extensible : If you need a key piece of code that runs fast, or want to write some algorithms that you don't want to open, you can use C or C++ to complete that part of the program, and then call it from your Python program.

  • Databases : Python provides interfaces to all major commercial databases.

  • GUI programming : Python supports GUIs that can be created and ported to many system calls.

  • Embeddable : You can embed Python into C/C++ programs, allowing users of your programs to gain "scripting" capabilities.

Two, Python environment construction

1. Python3 download

  • The latest source code, binary documents, and news information of Python3 can be found on Python's official website:

Python official website: https://www.python.org/

insert image description here

  • You can download the documentation for Python at the link below, and you can download the documentation in HTML, PDF, and PostScript formats.

Python document download address: https://www.python.org/doc/

2. Python installation

  • Remember to check Add Python xxx to PATH

insert image description here

  • Press the Win+R key, enter cmd to bring up the command prompt, and enter python:

insert image description here

  • If Add Python 3.6 to PATH is not checked, you can also set environment variables in Windows (oython installation directory, such as D:\Program Files\Python311)

insert image description here

3. The first Python3.x program

  • For most programming languages, the first introductory programming code is "Hello World!", the following code uses Python to output "Hello World!":
#hello.py文件
print("Hello, World!")
  • Python common file extension is .py, you can save the above code in the hello.py file and use the python compiler Pycharm to execute the script file

insert image description here

Summarize

Everyone is welcome to leave a message for exchange and criticism. If the article is helpful to you or you think the author's writing is not bad, you can click to follow, like, and bookmark to support.
(The reference source code of the blog can be found in the resources on my homepage. If you have any questions during the learning process, please feel free to ask me in the comment area)

Guess you like

Origin blog.csdn.net/HHX_01/article/details/132361201