ShuangSeQiu program

Color ball lottery purchase program

      Let the user select six red ball, and then select two basketball, finally unified print ball numbers selected by the user.

      To ensure that the user can not select repeated, can not exceed the selected number range.

       6 red balls range 1-32

       2 basketball color range 1-16

 

 

. 1 redlist = []
 2 bluelist = []
 . 3 COUNT = 0
 . 4 count2 = 0
 . 5  
. 6  the while COUNT <. 6 :
 . 7      red1 = INPUT ( " ------- input you have to select the red ball ----- ---- " )
 . 8      IF  Not red1.isdigit ():
 . 9          Print ( " enter number " )
 10          # red1 = int (red1) 
. 11      elif red1 in redlist or   int (red1)> 32 or red1 == 0:
12 is          Print ( " red ball selected from the range I -32 " )
 13 is          Print ( " the presence of the selectable range or beyond the red ball " )
 14          Continue 
15      the else :
 16          redlist.append (red1)
 . 17          COUNT +. 1 =
 18 is  
. 19  
20 is  the while count2 <2 :
 21 is      Blue1 = iNPUT ( " ~~~~~~ input you have to select blue balls ~~~~~ " )
 22 is      IF  Not blue1.isdigit ():
 23 is          Print ( " enter number " )
 24     elif Blue1 in bluelist or int (Blue1)> 16 or Blue1 == 0:
 25          Print ( " blue balls selected from the range 1-16   " )
 26 is          Print ( " blue balls beyond existing or selectable range " )
 27          Continue 
28      the else :
 29          bluelist.append (Blue1)
 30          count2 +. 1 =
 31 is  redlist.sort ()
 32  bluelist.sort ()
 33 is  Print ( ' your red ball is selected from: ' , redlist)
 34 is  Print (' You chose blue ball is: ' , bluelist)

 

---------------------- ------------------ experience

Ins and Outs wrote three hours now.

Uses

List,

Add apped 

while loop, 

if.elif.else cycle 

 continue 

Determine whether it is digital.  

Sequence

------------------------------------------------

Programming this thing, really want to write, I believe.

Always start to write an infinite loop, obviously gave count <10, such similar conditions, only to discover later, is the input () put out.

This common bug, because the code is written less.

-------------------------------------------------

 

This program, would have required verification did not say whether it is digital, and some other conditions, these are the bug later I slowly realized the function, the debugging process, found

The process of writing code is also encountered after apped added, the list returns None, 

That is because the written list = list.append (str)

Should be directly list.append (srr)

To write more later. Write more. These years owe code is written back.

Guess you like

Origin www.cnblogs.com/666sss/p/11563476.html