+ 10

Is there a way to exit a module?

For example, let's say I import the random module to shuffle a list, I like the way it is shuffled. Now, how do I exit the random module to keep my list from being shuffled anytime I press a key? Can this be done? Something like this: https://code.sololearn.com/chY4TRV8yKMb/?ref=app

30th Jul 2020, 7:52 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
8 odpowiedzi
+ 3
Tomiwa Joseph I'm not sure if I understood the question well but why not put shuffle(name) in a while loop so that once the desired list arrangement is reached, the user can enter a string (or whatever) like "done" to break from the loop. Then you can go from there... 🤔
30th Jul 2020, 6:06 PM
👑 Tchybooxuur!
👑 Tchybooxuur! - avatar
+ 1
Return
31st Jul 2020, 3:14 PM
Sanjay Kamath
Sanjay Kamath - avatar
0
It's not what you type after ')' It's that the random function returns a different value each time you run the code because I think it depends on time
30th Jul 2020, 7:42 PM
Wally
Wally - avatar
0
Doniyorbek Urinboyev yeah, sometimes i don't know if "computers" like this are extremely clever or absolutely stupid, lol
30th Jul 2020, 7:53 PM
Wally
Wally - avatar
0
When you hit run the random function gives another value so the string changes.. mmh what would you like to do?
30th Jul 2020, 7:55 PM
Wally
Wally - avatar