Card Games bug in Python

Is it me does this exercise have a bug on the 5. Alternate Averages wherein the index of the input list is mixed up?

Can you provide more details? Perhaps show an example list and explain where the bug is.

my code goes :
if (hand[-1] + hand[0])/2 == float(sum(hand))/len(hand):
return True
return False

the issue for one test is :
when I tried to print it the hand[0] which is the first index of the list, it takes the 2nd element of the list instead of the first.

Read the instructions a bit more closely:

She has thought of two ways of getting an average-like number

You have implemented one way.


I didn’t pay attention to it. thank you. finished it

1 Like