On Sunday, October 9, 2016 at 12:12:06 PM UTC+5:30, Steve D'Aprano wrote: > On Sun, 9 Oct 2016 02:51 pm, Cai Gengyang wrote: > > > I defined both done and pygame in this piece of code, but now i get a new > > error that i have never seen before, an AttributeError > > AttributeError usually means you have the wrong kind of object: > > py> mylist = {} # oops, a dict not a list > py> mylist.append(1) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'dict' object has no attribute 'append' > > > or sometimes you have the right object but misspelled the attribute or > method: > > py> mylist = [] > py> mylist.apend(1) # oops, spelling error > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'list' object has no attribute 'apend' > py> mylist.append(1) > py> print(mylist) > [1] > > > > >>>> rect_x = 50 > >>>> rect_y = 50 > >>>> done = False > >>>> pygame = True > > Why have you defined pygame = True? Is that what the code on the website > does? > > My guess is that you are supposed to say: > > import pygame > > > > Why don't you try my suggestion of saving the code into a .py file, then > using the File > Open command to open it?
One meta-suggestion: It may be that with python you can go further in less time than with older languages like C++, Java etc. But less time doesn’t mean no time — You still need to learn, to walk the learning curve In short: Dont skimp on the tutorial: https://docs.python.org/3/tutorial/ even (especially) if you find the examples uninteresting/irrelevant -- https://mail.python.org/mailman/listinfo/python-list