1. fixed format
Note: Do not forget to write after if else! Don't forget to write it! Don't forget to write it!
If <condition judgment 1>: <execution 1> Elif <condition Judgment 2>: <execution 2> Elif <condition judgment 3 >:< execution 3> else: <execution 4>
2. input in the input console
You can define a variable to receive the value entered on the console;
1 name = input ("Enter the user name ")
Note: The data type returned by input is str. If you want to compare it with the numeric type, you need to convert it.
1 S = input ('birth: ') 2 birth = int (s)
3. Simple examples of IF and Input
1 name = input ("enter user name") 2 code = input ("Enter Password") 3 if name = "root" and code = "root ": 4 print ("Login successful") 5 Elif name = "root" and code! = "Root": 6 print ("Incorrect password") 7 Elif name! = "Root" and code = "root": 8 print ("Account Error") 9 else: 10 print ("account name and password error ")
3. If condition judgment