I’m having trouble with trying to align lists together correctly with one holding an int datatype while the other is of strings. I’ve been practicing on iterating through a list comprised of college names, while the other list is of total in-state cost. I found out that when printing the list of college names it’s all in alphabetical order.
However, the total in-state costs don’t align with the appropriate college names. For example, Augustana college, which is first on the names list, has an incorrect tuition cost. So, Augustana has an index of 0 in names but the correct price has an index of 12 in the total cost list. Here’s a piece of code I did
costs=[cost for cost,group in colleges.groupby('Total Cost In-State')] costs=[int(i) for i in costs] print(costs)
output will be:[15162, 19938, 22200, 23273, 27702, 29117, 29758, 31990, 37010, 37994, 45644, 50006, 53707, 65386]
Compare this to the picture I attached.
As seen, the order of the two list are non-existent and need help.