this error means you are trying to call insert() method which owned by list data type, while the data type you are trying to use is an Integer. In your deal_card function,
def deal_card():
"""Returns a random card from the deck."""
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
card = random.choice(cards)
return card
card = random.choice(cards) will give choose a random value from your cards list, in which will return a whatever type that is chosen in cards list, in your cases is an Integer type.
note that insert() must have 2 parameters to be passed for further information, you can read here
if you want to make a list of the chosen random cards i would recommend to use append() and you can try to use a different attribute maybe called card for passing the data, or just directly append the deal_card function since its return a value, here's an example:
# to use append you should already have a list whether its empty or not
player = []
card = deal_card()
# can also use player.append(deal_card()), in that case you won't need the card variable
player.append(card)
player = deal_card()thenplayeris a number. You cannot insert a number into a number because number is not a collection. Did you mean to instantiateplayeras a list of numbers?print(type(player))output? Isplayera list? According to this code, it's an integer.