Python Modules | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python Modules

import random for i in range(6): value=random.randint(1,51) print(value) is there a way i could modify this code make sure even if it prints random numbers it wont print one number twice...more like in lotto

21st Sep 2019, 4:38 PM
Ezra Chisale
Ezra Chisale - avatar
2 Answers
+ 1
thanks lemme try that
21st Sep 2019, 6:53 PM
Ezra Chisale
Ezra Chisale - avatar
0
import random Last=0 def pp(): global Last value=random.randint(1,51) if (value != Last): Last=value print(value) else: pp() for i in range(6): pp()
21st Sep 2019, 6:51 PM
Sousou
Sousou - avatar