Sharing Lotto, the largest lottery in Korea, is conducted by selecting 6 different numbers from 1 to 45. The number of sharing lotto can be selected by the buyer himself, but it can also be selected in an "automatic" way that is left to the machine. Write a program that meets the following conditions so that you can participate in the Sharing Lotto in an 'automatic' manner.
Conditions:
Example of 10 iterations of a function that satisfies a condition: enter image description here
What code should I use to program like this?
umm guys, i want code. i have not error guys
import random
ans = []
while len(ans)<6 :
x = random.randrange(0,45,1)
if x in ans:
pass
else:
ans.append(x)
ans.sort()
print(ans)
@Aiden this should work, turns out maybe you are not allowed to use numpy