Manually (without any methods) create a two-dimensional list to combine subjects
and grades
. Use the table below as a reference to associated values
Hello @pawelk86, welcome to the forums! Unfortunately, we can’t just give away code; if you have some code, we can help you fix it, or if you have an idea, we can help make it work.
Having said this, remember that a 2D-list looks like this:
2d_list = [["this", "is"],["a", "2d"],["list"]]
the output is not as it should be
No, it isn’t. I think the exercise wants you to pair the one element of subjects
with one element of grades
, like so:
["physics", 98]
yes, that want to achieve
So if that’s the desired output for one set of grades/subjects, how would you combine all of them? Once you’ve done that, how would you combine them into a 2-d list?
These forums aren’t just about giving away answers; they’re also about encouraging the correct thinking.
yes i forgot that, i need 2-d list but forgot how do it I think I redoo that lesson o read curse book
i tried to make it print
gradebook = [subjects, [grades]]
print(gradebook)
but I got this as output
[[‘physics’, ‘calculus’, ‘poetry’, ‘history’], [[98, 97, 85, 88]]]
and I think it should be [physicis, 98 ] and so on
You are correct, it should be. Remember the lesson wants you to manually do it, so there’s no need to try and do it in a fancy way. Remember this is a two-d list:
2d_list = [["this", "is"],["a", "2d"],["list"]]
You want the output to have each nested list including one grade and one subject.
thanks i feel so mooron
now it’s good
gradebook = [[subjects[0], grades[0]],[subjects[1], grades[1]], [subjects[2], grades[2]], [subjects[3], grades[3]]]
print(gradebook)
i coppied pasted first one and put relevant indices I don’t know does this count as manual
I think it counts as manual. It certainly works! The way I’ve seen other people do it is just like this:
[["physics", 98], ["calculus", 97]](etc)
But I actually prefer your way
in that exercise i know i could use for or while loop, I use Mimo coding learning app since October and on Codecademy pro since late December but still struggling