What is problem?
I want to play a card game There are some rules 1. There are 32 cards with 0 and 1 on each sides 2. Line up the cards with 0 side facing up 3. Put all the cards upside down in order, starting from left 4. Stop when the top side is changed from 0 to 1 (You did 1 time) 5. If you stop, leave the cards as they are and restart, following the rules 6. When the top side is changed from 1 to 0, continue(don't stop) In what order are cards lined up when you do this 32 times? (I'm super newbie on programming) list = [0] * 32 #There are 32 cards z = 1 while z <= 32: #Plays 32 times x = 0 if list[int(x)] == 0: #0 -> 1 list.remove(int(x)) list.insert(int(x), 1) x = x + 1 else: if list[x] == 1: #1 -> 0 list.remove(int(x)) #System says this line is problem list.insert(int(x), 0) z = z + 1 print(list)