I'm making a program that shuffles a specific code.
Each letter and number has a specific variable represeting them such as code1, code2, code3 etc. So lets say 1 is sait to code1, 2 to code 2, 3 to code3 etc. So here's what I've done, I've put the all the variables in a list like this, and in it's current state, is 1234, so I put it in a list.
code = [code1, code2, code3, code4] shuffle(code)
So, it shuffles the list, but now my problem is getting the list to go back into a code again, the code MUST be on one line and have no spaces in it. Also, each number is a string. So I've tried using a for loop and adding the strings to each other but that didn't work, I checked over and over again and it just didn't work.
So I tried it again, it said rand was not defined. Okay, so shuffled is the current name of the shuffled list. Before the for loop takes place count is already defined as 0.
for number in shuffled: if count == 0: sub_set = number count += 1 if count == 8: rand = number quit if count != 0: if count != 8: sub_set += number count += 1 print (rand) input ()
still can't get it too work.
Edited 7 Years Ago by AutoPython: n/a