Python study notes 1-environment construction


Course directory jump, updating...
1. Python study notes 1-environment construction
2, Python study notes 2-design the first program with Python
3, Python study notes 3-variables and strings
4, Python study notes 4-yes Time to talk about the code
5,
6,
.
.
.
.

1. Introduction to 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 more distinctive grammatical structures than other languages.

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

  • 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 it supports a wide range of application development, from simple word processing to WWW browsers to games.

2. Features of Python

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

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

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

  • 4. An extensive standard library: One of Python's greatest strengths is its rich library, cross-platform, and compatible with UNIX, Windows, and Macintosh.

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

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

  • 7. Extensible: If you need a key piece of code that runs quickly, 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.

  • 8. Database: Python provides interfaces to all major commercial databases.

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

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

3. Download the Python installation package

Having said so much, it’s better to actually do it. To run the program, you must first have a running environment, such as Python. We first go to the official download the installation package. You can see that the latest version is Python3.11.
insert image description here
The official website generally downloads slowly , wait patiently. It is enough to download 32 bits here. After downloading, the normal software installation process
insert image description here
goes all the way to next until the installation is complete.
After the installation is complete, you can find the newly installed Python folder in the figure below and enter IDLE (Python 3.x 32-bit)
insert image description here

This is the development environment of Python. Going here means that you have already started
insert image description here

4. The first program "Hello World"

When it comes to writing code, you will remember the first program "Hellow World" that the ignorant boy got started. In fact, the program that uses "Hello" and "World" together first appeared in 1972. Brian, a member of Bell Labs, In the internal technical document "Introduction to the Language B" written by Kernighan, "Hello World" is used here again to pay tribute to the predecessors

printf("hello, world\n");   //C语言语句

Then we write the first code in Python

print("hello, world");

Careful students may ask why the printf written by Brian Kernighan has an extra "f" compared to the print we write in Python. The language is different, and the grammar must be different. For example, English and Chinese are very different.
Note: When writing code, the input method should be in English, such as Chinese brackets "(", which are different from English brackets "(".

insert image description here
Well, that's right, hello and world are indeed displayed on the interface, and they are executed three times.
At this point, the environment is set up, let's enter our Python journey! ! !

Guess you like

Origin blog.csdn.net/weixin_42163707/article/details/128210753