Today I learned mainly about the main points of the cycle,
1.use ofelif
whiletrue:temp= Input ("Please enter a score:") score=int(temp)if ->= score >= -: Print ("A") Elif ->= score >= the: Print ("B") Elif the>= score >= -: Print ("C") Elif ->Score:print ("D") Else: Print ("Input Error")
2. Use ofassert :
When the following condition is true, the error occurs when the condition is false.
3. Ternary conversion
4,5if x > y = yelse: = x
Equivalent to:
if Else y
That is, the x if condition else y
Noun Explanation:
Membership operators
Hands-on section: The classification of fractions, adding a cycle of their own parts,
whiletrue:temp= Input ("Please enter a score:") score=int(temp)if ->= score >= -: Print ("A") Elif ->= score >= the: Print ("B") Elif the>= score >= -: Print ("C") Elif ->Score:print ("D") Else: Print ("Input Error")
(note not added, back one by one plus)
Score =int(Input ('Please enter a score:'))if the> Score >= -: Print ('C') Elif -> Score >= the: Print ('B') Elif -> Score >=0: Print ('D') Elif ->= score >= -: Print ('A')Else: Print ('input Error! ')
(Source code)
On the ternary conversion
6 5 4 if x < y: = x if z < small: =< z:< c13/>= yelse: = Z
if Else if else z)
Little Turtle Python Video Sixth lecture (Notes and program source code)