Solved. Quesitos whats wrong in my Code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Solved. Quesitos whats wrong in my Code?

Whats wrong in my Code? The Output Should be 4 times different lottery Numbers and Not 4 time the Same. https://code.sololearn.com/cfw245R3Pd5M/?ref=app

24th May 2021, 7:12 AM
Angela
Angela - avatar
3 Answers
+ 3
Put num = [] line inside function .
24th May 2021, 7:23 AM
TOLUENE
TOLUENE - avatar
+ 3
After first function call your num list gets filled with 6 random int . so for 2nd,3rd,4th call the while loop doesn't run so num is returned same as first function call. When you declare num = [] inside function. Everytime the function is called num list is filled with 6 random int.
24th May 2021, 7:26 AM
TOLUENE
TOLUENE - avatar
+ 1
Many thanks . Now its works as expected
24th May 2021, 7:36 AM
Angela
Angela - avatar