I am making a Rubik's cube scrambler program using python 3.10.2 and everything works correctly except for one thing. When the randomly generated scramble is outputted, unwanted square brackets, quotation marks and commas show up as well. Any idea on how to fix this? -Thank you
import random
notation = ["R","L","F","B","U","D","R'","L'","F'","B'","U'","D'","R2","L2","F2","B2","U2","D2"]
scramble = []
i = 0
while i < 9:
randomNotation = random.choice(notation)
scramble.append(randomNotation)
i += 1
print(scramble)
Output: ['L2', 'L', "R'", "D'", 'L', 'F2', 'R', "D2", 'L']
You're printing a
list
and that's what the default string representation oflist
looks like. If you want to format the values into something different you have many options. For example: