u/Blakbard

New to Python, error warning

>!Card_dic={“Player_card” : {“rand_list” : [1,2,11], P_sum” : 0}!<

>!Def outcome(user_card, sum):!<
*** ***>!Ace = 11!<
*** ***>!num= card_dic[user_card][“rand_list”]!<
*** ***>!For elements in num:!<
*** ***>!if elements == ace:!<
*** ***>!#do something.!<

Warning ⚠️: Expected type ‘collections.iterable’, got ‘list[Any]| int’ instead.

I am trying to assign the list card_dic[user_card][“rand_list”] into num and iterate through the list until it finds ace(11).

I can’t seem to figure out why it’d think the list is a list or int. I’ll appreciate a good explanation or documentation that explains this behavior. What am I doing wrong?

reddit.com
u/Blakbard — 7 days ago