Skip to content
Advertisement

Python Trying to assign 100 values to 100keys with some conditions

I’m new at python so please go easy on me. The users is a dict [str,list[str].The keys are just user1, user2 etc until 100. The list of strings contains 10 songs each. The premade_playlist also has keys premade1, premade2 etc until 100.The values are also a dict [str,list[str] and contains about 50 songs in the list[str].

I am trying to assign a str value to each user, if the premade playlist has 3 songs that the user has in their values and 3 that the user doesnt have in their values. However it keeps giving me only one premade. I am stuck as to what i should do abou this. Any help would be appreciated.

i printed out the premade_for_user and got a dict with all values premade1

JavaScript
JavaScript

Advertisement

Answer

i’m not exactly sure what you want to do but i have created this sample:

JavaScript

I hope this helped.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement