Bool, if, while, randint, boolrandint
1. bool Value
This seems understandable. There are comparison operators, and logical operators all generate bool values. First, let's look at these. This is true or false in Middle School Mathematics questions (think of the pain of mathematics ).
There is an int function. Baidu's explanation is rounded up. Do not deliberately understand, for fear of getting into a dead end.
2. if
When we see whether it is true or false or if, it is really a problem of a mathematical problem. Note that you always write numbers directly instead of the variable name. Num = 10. It should be num. The reason for the running error is that the English state is not added after the if statement: after it is added, it is OK. You're a fucking genius.
3. while
Are you sure you want to lose? The original equal sign = is mixed with the value =. Syntax error, invalid syntax. When the while statement is followed by the if statement:
It seems that you really need to be careful when learning this... Although an error is reported, the English language is too watery. Answer is not defined when the problem occurs in Row 6. After reading the example, I didn't assign a value to answer, that is, I couldn't know what answer is in these statements. If answer> num, what is greater than 10? This is the cause of the error. Remember to assign the value =, equal to =
After the change, as long as bingo = False, the loop will continue and end. As long as the bingo value is changed to another value after the correct statement, the loop ends.
Also, if and while must be indented. But I used pycharm, which automatically indented me.
4. randint
First, remember the from Module name import method name. from random import randint can be used to generate random numbers.
Details! If a punctuation mark is incorrect, it cannot be used. I forgot what went wrong after the change.
It turns out that answer = input () is placed outside the while loop, so it is always in the large condition of bingo = False and answer = input. Always output too small.
That's it today.