Python loop while and for in simple example, pythonwhile
Python loop while and for in simple instances
#! /Uer/bin/env python # _ * _ coding: UTF-8 _ * _ lucknumber = 5b = 0 while B <3: print ('guss count: ', B) a = int (input ('You guse number') if a> lucknumber: print ('youaerbiger') elif a = lucknumber: print ('youare righet ') break # Jump out of this level of loop else: print ('You aer smaller ') B + = 1 # In the while LOOP, + = 1 is a must loop body else: print ("Too required retrys! ") # ________________________________________________ For I in range (3): a = int (input ('You guse number') # Use int () indicates that the output is of the numeric type if a> lucknumber: print ('youaerbiger ') elif a = lucknumber: print ('youare righet') break else: print (you aer smaller ') else: print ("Too success retrys! ")
The above python loop while and for in is a simple example of all the content shared by xiaobian. I hope to give you a reference and support for the help house.