argument of type 'int' is not iterable ?
import random def deal_card(): cards=[11,2,3,4,5,6,7,8,9,10,10,10,10] card=random.choice(cards) return card """"Retruns a random cards""""" def calculate_score(cards): if 11 in sum(cards)==21 and len(cards)==2: return 0 if 11 in cards and sum(cards)>21: cards.remove(11) cards.append(1) return cards user_cards=[] computer_cards=[] is_game_over=False for _ in range(2): new_card=deal_card() user_cards.append(new_card) computer_cards.append(deal_card) while not is_game_over: user_score=calculate_score(user_cards) computer_score=calculate_score(computer_cards) print(f" Your cards:{user_cards}") print(f"Computer's First card:{computer_cards}") if user_score==0 or computer_score==0 or user_score>21: is_game_over=True else: user_should_deal=input("Type 'y ' to get another card, type 'n' to pass: ") if user_should_deal=="y": user_cards.append(deal_card()) while computer_score!=0 and computer_score<17: computer_cards.append(deal_card()) computer_score=calculate_score(computer_cards)