#if basic statement
IF 1 == 1 : Print ( " If the condition is true, if the statement is executed " ) the else : Print ( " if the condition is false, if the statement is executed " )
Analyzing Multiple #if
# 1 example
INPUT = InP ( " Please enter the code number 1 or 2: \ n- " ) IF InP == " 1 " : Print ( " into the game zone " ) elif InP == " 2 " : Print ( " enters the zone learning " ) the else : Print ( " mistyped " )
# Example 2
= the INPUT INP1 ( " Please enter your membership level " ) IF INP1 == " super affiliates " : Print ( " first-line Star " ) elif INP1 == " Platinum Membership " : Print ( " second-tier Star " ) elif INP1 == " Gold Member " : Print ( " three lines Star " ) the else : Print ( " shit does not give " )
#if supports nested (unlimited nested)
IF . 1. 1 == : IF 2 == 2 : Print ( " enter the first Club " ) Print ( " enters the second Club " ) the else : Print ( " into the third Club " ) the else : Print ( " do not enter clubs " )
#Pass use
IF 1 == 1: # at this time if the following is true nothing can be used to perform PASS Pass the else : Print ( " false directly to here " )
# String
# addition
= name " Hua " Particular = " is NB " Jia = name + Particular Print (Jia) # Hua is NB
#multiplication
= NAME1 " Bob " Cheng = NAME1 * 10 # corresponds repeated 10 times Print (Cheng)
# Digital
# to add, subtract, multiply, divide
a1 = 12 a2 = 13 a3 = a1 + a2 a4 = a2- a1 A5 = a1 's * A2 a6 = a2 / a1 A7 = 39% 2 # I taken. Analyzing may be even or odd Print (A3) Print (A4) Print (A5) Print (A6) Print (A7)
# Determination is odd or even
int = inp3 (INPUT ( " Please enter a number: \ n- " )) # as a string can not be directly modulo input, needs to be converted to an int temp= inp3 % 2 IF TEMP == 0: Print ( " even-numbered " ) the else : Print ( " odd " )