One of the kids in my class (who has obviously taken an interest in programming) has come to me with a problem - I've attempted to work out what the issue is but I've told him I couldn't see it. Can someone have a look please and tell me what the issue is (it is to do with line 82 I think - it's been annotated at that point) - any help would be appreciated
import random
Ace_h = [1, '♥']
Two_h = [2, '♥']
Three_h = [3, '♥']
Four_h = [4, '♥']
Five_h = [5, '♥']
Six_h = [6, '♥']
Seven_h = [7, '♥']
Eight_h = [8, '♥']
Nine_h = [9, '♥']
Ten_h = [10, '♥']
Jack_h = [11, '♥']
Queen_h = [12, '♥']
King_h = [13, '♥']
Ace_c = [1, '♣']
Two_c = [2, '♣']
Three_c = [3, '♣']
Four_c = [4, '♣']
Five_c = [5, '♣']
Six_c = [6, '♣']
Seven_c = [7, '♣']
Eight_c = [8, '♣']
Nine_c = [9, '♣']
Ten_c = [10, '♣']
Jack_c = [11, '♣']
Queen_c = [12, '♣']
King_c = [13, '♣']
Ace_d = [1, '♦']
Two_d = [2, '♦']
Three_d = [3, '♦']
Four_d = [4, '♦']
Five_d = [5, '♦']
Six_d = [6, '♦']
Seven_d = [7, '♦']
Eight_d = [8, '♦']
Nine_d = [9, '♦']
Ten_d = [10, '♦']
Jack_d = [11, '♦']
Queen_d = [12, '♦']
King_d = [13, '♦']
Ace_s = [1, '♠']
Two_s = [2, '♠']
Three_s = [3, '♠']
Four_s = [4, '♠']
Five_s = [5, '♠']
Six_s = [6, '♠']
Seven_s = [7, '♠']
Eight_s = [8, '♠']
Nine_s = [9, '♠']
Ten_s = [10, '♠']
Jack_s = [11, '♠']
Queen_s = [12, '♠']
King_s = [13, '♠']
Deck = [Ace_h, Two_h, Three_h, Four_h, Five_h, Six_h, Seven_h, Eight_h, Nine_h, Ten_h, Jack_h, Queen_h, King_h, Ace_c, Two_c, Three_c, Four_c, Five_c, Six_c, Seven_c, Eight_c, Nine_c, Ten_c, Jack_c, Queen_c, King_c, Ace_d, Two_d, Three_d, Four_d, Five_d, Six_d, Seven_d, Eight_d, Nine_d, Ten_d, Jack_d, Queen_d, King_d, Ace_s, Two_s, Three_s, Four_s, Five_s, Six_s, Seven_s, Eight_s, Nine_s, Ten_s, Jack_s, Queen_s, King_s]
random.shuffle(Deck)
n = 0
while n != 5:
if Deck[n][0] == 1:
print('Ace', Deck[n][1])
elif Deck[n][0] == 11:
print('Jack', Deck[n][1])
elif Deck[n][0] == 12:
print('Queen', Deck[n][1])
elif Deck[n][0] == 13:
print('King', Deck[n][1])
else:
print(Deck[n][0], Deck[n][1])
n = n + 1
n = 0
X = 5
while n != 5:
L = 'False'
Hand = [Deck[0], Deck[1], Deck[2], Deck[3], Deck[4]]
print('Do you wish to discard', Hand[n][0], Hand[n][1], '?(Yes/No)')
ans = input()
if ans in ['Yes', 'yes', 'YES', 'Y', 'y']:
Hand[n] = Deck[X] # Value is changing but variable isn't saving
X = X + 1
print(Hand)
n = n + 1
n = 0
while n != 5:
if Hand[n][0] == 1:
print('Ace', Hand[n][1])
elif Hand[n][0] == 11:
print('Jack', Hand[n][1])
elif Hand[n][0] == 12:
print('Queen', Hand[n][1])
elif Hand[n][0] == 13:
print('King', Hand[n][1])
else:
print(Hand[n][0], Hand[n][1])
n = n + 1# Results of programOutput:5 ♦
6 ♥
3 ♣
6 ♦
5 ♥
Do you wish to discard 5 ♦ ?(Yes/No)
y
[[7, '♠'], [6, '♥'], [3, '♣'], [6, '♦'], [5, '♥']]
Do you wish to discard 6 ♥ ?(Yes/No)
y
[[5, '♦'], [11, '♠'], [3, '♣'], [6, '♦'], [5, '♥']]
Do you wish to discard 3 ♣ ?(Yes/No)
y
[[5, '♦'], [6, '♥'], [3, '♦'], [6, '♦'], [5, '♥']]
Do you wish to discard 6 ♦ ?(Yes/No)
y
[[5, '♦'], [6, '♥'], [3, '♣'], [2, '♣'], [5, '♥']]
Do you wish to discard 5 ♥ ?(Yes/No)
y
[[5, '♦'], [6, '♥'], [3, '♣'], [6, '♦'], [12, '♥']]
5 ♦
6 ♥
3 ♣
6 ♦
Queen ♥
