Going fast! #DataquestChallenge Premium Annual Offer:
500 get 50% & the next 1000 get 40% off.
GET OFFER CODE

Problem12: Laptop

from csv import reader
file=open("laptops.csv")
reader=reader(file)
data=list(reader)
data=data[1:]
price_to_name={}
for a in data:
    price_to_name[int(a[2])]=a[1]
for a in price_to_name:
    for b in price_to_name:
        if price_to_name[a]!=price_to_name[b] and a+b==5000:
            laptop1=price_to_name[a]
            laptop2=price_to_name[b]

Why is my code wrong?

Please make sure to include the link to the content your code/question corresponds to in your post. It helps provide context to your question, making it easier for others to help you out.