A friend who has been learning Python for ten days with zero basics wrote a small game. It turns out that it is very easy to get started!

The most important thing in self-learning a language is to give yourself feedback in time, so it is very important to often write some small programs to cultivate a sense of language. After writing, you can summarize the scattered knowledge points used in the program.

A friend who has been learning Python for ten days with zero basics wrote a small game. It turns out that it is very easy to get started!

The knowledge points used in this program are:

1. Input and output functions (input, print)

2. Assignment statement (=)

3. Define variables (naming conventions for variable names)

4. Data type conversion (int)

5. Import modules (random, os)

6. Module method calls (.randint, .system)

7. Nesting of "while-else loop" and "if-else conditional judgment"

8. Use of escape characters ( )

9. Python comment specification (# and comment content are best left blank)

The source code of the entire program is attached. In order to prevent friends who directly copy the code, the editor is here to show everyone in the format of pictures in order to let everyone learn the code by themselves and enhance the understanding of the code!

A friend who has been learning Python for ten days with zero basics wrote a small game. It turns out that it is very easy to get started!

This is the effect after running:

A friend who has been learning Python for ten days with zero basics wrote a small game. It turns out that it is very easy to get started!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324399968&siteId=291194637