Hello everyone,
I did have a look around with search option to see if I could get an answer their, but I couldn't quite find my issue(at least I don't think I did). This is for a final project for school where I have to create a class for a deck of cards and let the user do several things with it. One of these things is cutting the deck so that the top 26 cards(assuming this is a standard 52 card dec)are now on the bottom. This is where the problem comes up.
def cut_deck(self):
cut_deck = []
index = 0
for loop in range(26, 52):
cut_deck[index] == self.__cards[loop]
index = index + 1
for loop in range(0, 26):
cut_deck[index] == self.__cards[loop]
index = index + 1
self.__cards = cut_deck
The self.__cards array is initialized earlier on in the class and it sets up fine. This is the only part that does not work for me. I keep getting an error 'IndexError: list index out of range'. I took a look on google and I did find some similar issues, but I still can't figure out the problem. Any help would be greatly appreciated. Thank you in advance.