# import random module
Import the random
# define brings
Def daletou (times) :
# to create brings empty list
Numbers=[]
# according to how many times have you how many injection cycle under
For I in range (0, times) :
# number list
Number=[]
Red list of numerical range # 1-35
Numred=list (range (1, 4))
Remove the # 1-35 in any of the five
Numred1=the random sample (numred, 5)
Numerical range 1-12 # blue list
Numblue=list (range (1, 13))
Remove the # 1-12 of any two
Numble1=the random sample (numblue, 2)
# will be ordered number
Numred1. Sort ()
Numblue1. Sort ()
# will be red and blue list out numerical together, in the number of the list
Number=numred1 + numblue1
# condition is set in the list, less than zero in front of the value adding 0
For n in the range (len (number)) :
If the number [n] <10:
The number [n]='0' + STR (number [n])
# will number the value added to the Numbers in the list of
Numbers. Append (number)
Return Numbers
The import module
The import daletoumokuai
Print (' brings the lottery! ')
Times=input (' please enter the note number:)
Numbers=daletoumokuai. Daletou (int) (times)
For I in range (times) :
Print (' {} {} {} {} {} {} {} '. The format (Numbers [0], [I] Numbers [1], [I] Numbers [2], [I] Numbers [n], [3] Numbers [4], [I] Numbers [5], [I] Numbers [I] [6]))
Then an error
Traceback (the most recent call last) :
The File "D:/py/demo/daletou py", line 4, the in & lt; module>
Numbers=daletoumokuai. Daletou (int) (times)
TypeError: daletou () missing 1 required positional argument: 'times'
I have no parameters, "he said." but I'm not defined? Don't understand don't understand oh (' - omega - `)
CodePudding user response:
I simply changed your code, and test the
Def daletou (times) :
# to create brings empty list
Numbers=[]
# according to how many times have you how many injection cycle under
For I in range (0, times) :
# number list
Number=[]
Red list of numerical range # 1-35
Numred=list (range (1, 36))
Remove the # 1-35 in any of the five
Numred1=the random sample (numred, 5)
Numerical range 1-12 # blue list
Numblue=list (range (1, 13))
Remove the # 1-12 of any two
Numble1=the random sample (numblue, 2)
# will be ordered number
Numred1. Sort ()
Numble1. Sort ()
# will be red and blue list out numerical together, in the number of the list
Number=numred1 + numble1
# condition is set in the list, less than zero in front of the value adding 0
For n in the range (len (number)) :
If the number [n] <10:
The number [n]='0' + STR (number [n])
# will number the value added to the Numbers in the list of
Numbers. Append (number)
Return Numbers
Def TTTT () :
Times=input (' please enter the note number:)
Numbers=daletou (int (times))
For I in range (int) (times) :
Print (' {} {} {} {} {} {} {} '. The format (Numbers [0], [I] Numbers [1], [I] Numbers [2], [I] Numbers [3], [I] Numbers [I] [4],
Numbers [5], [I] Numbers [I] [6]))
Output:
CodePudding user response: