+ 1
Help me generate non-repeating numbers
Need help fixing my code so that it doesn't print the same number twice unless it's the last number generated, the one that goes from 1-20. https://code.sololearn.com/cOZ1fHl1gl70/?ref=app
5 odpowiedzi
+ 2
Why not generate a list between 1-n then randomly pick an element from it, print it then remove it or shuffle the list then iterate over it (not my idea).
Shuffle idea:
https://code.sololearn.com/cwiosjxUAE2d/?ref=app
+ 2
Hi, here is a sample code you could use :
https://code.sololearn.com/chMyZI4C8xW3/#py
btw, you really dont need to use the import command 6 times in one code :)
TurtleShell the shuffle is a great idea :)
+ 2
You don't have to import a module each time you use it. Once is enough.
The line 'for any in range(1)' doesn't do anything. It defines a variable 'any' that is set to 0 but isn't used anywhere. 'any' is a python keyword, so it shouldn't be used as a name for a variable
https://code.sololearn.com/c1owuINvkAnE/?ref=app
+ 2
Thanks for all the feed back!
0
Proff yeah, I wish I could say I came up with it