Python Comparing sequential items in a list and removing one if they are the same
Python Comparing sequential items in a list and removing one if they are the same This is an attempt a Rubik’s Cube scramble generator. I sometimes get turns of the same face one after the other for example (R,R'). I attempted to fix this using a for and while loop but it didn't work. import random def getscramble(): moves = ["R","F","U","L","B","D"] scramble = finascramble = for x in range(25): scramble.append(random.choice(moves)) for x in range(0,len(scramble)-1): if scramble[x] == scramble[x+1]: scramble[x] = random.choice(moves) for x in range(0,len(scramble)-1): if scramble[x] == "R" and scramble[x+1] == "L": scramble[x+1] = random.choice(moves) if scramble[x] == "U" and scramble[x+1]== "D": scramble[x+1] == random.choice(moves) if scramble[x] == "F" and scramble[x+1] == "B": sc...