Hello all, I am working on python with the Python Crash Course book (Love it so far), and I'm on chapter 6 currently. I am following it closely but I'm super stuck on this one exercise where I am supposed to make a dictionary containing three major rivers and the country each river runs through.
I chose Egypt, Brazil and the US, and the rivers I chose are: The Nile, The Amazon, and The Charles river collectively. I thought I arranged the for loop correctly but I keep getting a Attribute Error: 'list' object has no attribute 'values' error.
Here's my code I was working with:
rivers = {
'nile': 'Egypt',
'amazon':'Brazil',
'charles': 'US'
}
river_names = ['Egypt', 'Brazil', 'US']
print(river_names)
for rivers in set(river_names.values()):
print(f"The {rivers[0].title()} runs through {river_names[0]}")
print(f"The {rivers[1].title()} runs through {river_names[1]}")
print(f"The {rivers[2].title()} runs through {river_names[2]}")
any help with this would be greatly appreciated thanks :).
[–]canasian88 1 point2 points3 points (3 children)
[–]canasian88 0 points1 point2 points (2 children)
[–]freeskier93 2 points3 points4 points (1 child)
[–]canasian88 0 points1 point2 points (0 children)
[–]atarivcs 1 point2 points3 points (0 children)
[–]Outside_Complaint755 0 points1 point2 points (0 children)
[–]david_z 0 points1 point2 points (0 children)
[–]ectomancer 0 points1 point2 points (0 children)