Design the first game with Python in the computer graduation project

What is BIF?
Answer: The built-in function BIF (built-in function) is convenient to write quickly. Python comes with a lot of BIFs. We can use the command dir (builtins) to view them. The lowercase letters start with the BIFs we want to view. You can see the introduction and usage of BIF through the help (BIF) command.

Count how many BIFs does Python3 provide using the method taught by the little turtle in the classroom?
Answer: The lowercase letters are all BIFs, and the number of BIFs is different for each version of Python.
image

From Python's point of view: Is'FishC' the same as'fishc'?
Answer: Not the same. "AAA" and "aaa" are different. Python treats variable names as case-sensitive.

From the point of view of the turtle, what is the most important thing in Python? Do you agree?
Answer: Indentation in Python is the most important thing. It is the soul of Python, just like the curly braces {} in C language, agree. Tip: typing a colon ":" will automatically indent.

"=" and "= =" appear in the examples in this lesson, they mean different meanings, do you accidentally write "=" as "=" in the process of programming? Is there a good way to solve this problem?
Answer: "=" means assignment, generally looking from right to left, "=" means equivalent, to judge whether they are equal, understand the two concepts are different. Generally, the scope of application of "= =" is in conditional judgment.

Have you heard the term "splicing"?
Answer: Concatenation is to concatenate data of the same type. In Python, this method is called concatenating strings.

Hands-on:

Write a program: hello.py, which requires the user to enter a name and print "Hello, name!"
For example: image
Answer:
image

Write a program: calc.py requires the user to enter a number between 1 and 100 and judge, if the input meets the requirements, it will print "Your sister is so beautiful", if it does not meet the requirements, it will print "Your uncle is so ugly".
For example:image

answer:image

Please write down what you have learned in this lesson: the format is not limited, and recalling and retelling is a good way to strengthen memory!
Answer: tab (indent, select letters), Ctrl+n to create new, Ctrl+s to save;
indentation is the soul of Python (it will automatically indent when you type a colon);
If else—conditional branch; "=" means assignment, "" The meanings are equivalent, to judge whether they are equal;
BIFbuilt-in function (built-in function, convenient to write quickly);
Dir (builtins) writes the BIF we want to view, through the help (BIF) command you can see the introduction and usage of BIF .

Guess you like

Origin blog.csdn.net/bwwork/article/details/113901649