S3 Date and Time
1. Get the current time DateTime.Now ()
2 extract Year,month, etc. from the information obtained from DateTime.Now
3 introduce the format of the output date into mm//dd//yyyy, we use the + to convert
4 introduce the format of the output date into HH:MM:SS, we use the + to convert
S4 Conditions and Control Flow
1 Python uses 6 ways to compare = =,! =, >, >=, <, <=, the result of comparison is true or false
Practice
1 set the value of Bool1 to < 118%100
2 Set the value of the bool2 to 100 = = 33*3 + 1
3 Set the value of Bool3 to <= 2**4
4 Set the value of the Bool4 to -22 >= -18
5 Set the value of BOOL5 to 99! = 98+1
2 connector and is used only if both sides of and are true then the result can be true
3 The use of the second connector or, as long as there is a true on either side of or, the result can be true
4 third connector not, if not true then result is false,not false result is true
5 because of the many expressions, we often use () to enclose some expressions so that they are more readable.
6 If, Elseif,else format is similar to C + +
def using_control_once (): if 1 > 0: return"Success #1"def Using_ Control_again (): if 1 > 0: return"Success #2 print ( using_control_once ())print (Using_control_again ())
Operation Result:
Python Learning DAY2