0
Please give me a solution
names = ['Eugenie','Ronald','Benedict'] scores = [68,52,40] >Put the data from the two lists above into a new list, called 'all_data'. > Each entry in this list is a dictionary. >Each of these dictionaries has the keys 'name' and 'score'. >The values for these keys are a name and a score from the two lists. > So the result will be: > [{'name':'Eugenie','score':68},{'name':'Ronald','score':52},{'name':'Benedict','score':40}] ### This will check solution: #print(all_data)
2 ответов
+ 1
Have your tried it yourself yet? Unfortunately, we can't help you until you've tried it yourself. In the meantime, here are some clues:
📍Use a for loop, and go through each item in both lists like this:
for student in range(len(names)):
current_student = names[student] #gets current student
current_grade = scores[student] #and their current grade
📍Append this information in a dictionary to all_data, which should be created first:
all_data.append({current_student, current_grade})
See if you can use the hints to figure out how to write the program.
0
I have tried for a long time, i have no intuition about how to reach to the solution