4. Process Control and recycling
Age = Raw_input (' Age: ') if Age>40:print ' old! ' Elif age>30:print ' young! ' Else:print ' younger! ' The If execution ends directly when the case is matched, not exiting else, the declaration of the variable can be omitted as equals = the definition of the assignment is a double equal = = = For loop for * in *:
5.while Cycle
The while loop defaults to a dead loop for the loop has a start end, the number of cycles print_num = input (' which loop do you want it to is printed out? ') Count = 0while Count < 100000: if count = print_num: &NBSP ; print ' There got the number: ',count choice = raw_input (' Do you want to Continue the loop? (y/n) ' if choice = = ' n ': break else: W Hile print_num <= count: print _num = InOut (' which loop do you want it to be printed out? ') print u "pass" &NBSP ; else: print ' Loop: ',count   count +=1 else: print ' Loop: ', Count
Python Process Control