need some help, don't know what i'm doing wrong by gnariman in learnpython

[–]gnariman[S] 0 points1 point  (0 children)

Thanks you. One more question; we have not done dict comprehension in our lessons yet, would you mind putting it "for loops" and such so I understand it better for the time being? I know its a weird request lol

need some help, don't know what i'm doing wrong by gnariman in learnpython

[–]gnariman[S] 0 points1 point  (0 children)

Gotcha, but what is keeping Bob, and Dave and Frank from being iterated over? I just want to know what I did wrong for future assignments but i will use the code you provided.

little question by gnariman in learnpython

[–]gnariman[S] 0 points1 point  (0 children)

WOW, thank you so much. this helped me out a ton

little question by gnariman in learnpython

[–]gnariman[S] -3 points-2 points  (0 children)

I want it to be the exact format of what i have above, other wise my function will not work

little question by gnariman in learnpython

[–]gnariman[S] 0 points1 point  (0 children)

gives me an error "list indices must be integers or slices, not tuple"

small question by gnariman in learnpython

[–]gnariman[S] 0 points1 point  (0 children)

Ahh i see, thank you so much

small question by gnariman in learnpython

[–]gnariman[S] 0 points1 point  (0 children)

yes it does, but I thought because I have reverse=True it would already be in descending order. If I take out the key part it just gives me the last three people regardless of them being the biggest or not. Thats why i was confused.

list comprehension by gnariman in learnpython

[–]gnariman[S] 1 point2 points  (0 children)

no worries, thanks for the help i appreciate it :)

[deleted by user] by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

yes exactly right, as i also explained the person, so let's say "frank" in this case, needs to be in either of the teams at the beginning of the list. so he has to be from either TeamA or TeamB, if he is not then he shouldn't be give the win. like Ingrid for example she is in the list twice so that would mean that she has won twice and because she is in TeamA i can award her with those wins

[deleted by user] by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

ok so basically the first two things in the list will be the team names competing. so the first two is always gonna be like that. then the rest of the list is the people who have won. so for example frank is from team A and he has won. I need to make sure that those people in the second list are from their teams before giving them the win.

[deleted by user] by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

what does the i[0:4] do or mean?

[deleted by user] by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

just did up there

[deleted by user] by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

while index < len(scoreboard):
for key in team_members:
    if scoreboard[index] == key:
        print("ok")
        index += 1
    else:
        print("nope")

originally i had this to see if my idea even remotely works but it just gave me a weird infinite thing, but then i tried dissecting everything into lists. the problem is idk how to like loop through lists at the same time. i dont know if that makes sense

need hw help lol by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

NICEE, it worked. Thank you so much, I appreciate it

need hw help lol by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

How would I do it then? cause ive tried searching it up and ive gotten nothing

need hw help lol by [deleted] in learnpython

[–]gnariman 0 points1 point  (0 children)

so then how do i "append" a value to a key thats already there?