On 23 October 2013 08:25, Corinne Landers <corinne.land...@live.com> wrote: > Hi guys,
Hi Corrine, > I need a bit of help. > I'm writing a class, and in the main function I'm trying to say if this > method gets called, do this. > I'm trying things like: > > program = AnimalClass(x,y,z) > for i in range(x): > for j in range(y): > for k in range(z): > animal = program.animal() > if animal: > if isinstance(animal,moose): > print("There is a moose here") > > It's clearly not correct because it's giving me all sorts of grief, but if > anyone knows how to do this correctly I'd very much appreciate it! I'm sure someone will help you but you haven't really given enough information yet. Is the code you posted the whole of your program? If so please say so explicitly because it looks like only part of a program to me and you should show the whole code for anyone to understand what you're doing. Also you say that it is giving you grief but we need more than that. Is it showing an error message? If so please copy/paste the whole error message and traceback. Here's an example showing what happens when I run your program as shown above (saved into a file called tmp.py): $ python tmp.py File "tmp.py", line 5 animal = program.animal() ^ IndentationError: expected an indented block What that error means is that you need to indent everything inside the 3rd for loop on line 5. Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor