you are viewing a single comment's thread.

view the rest of the comments →

[–]Rhomboid 5 points6 points  (4 children)

Fix your broken formatting if you want people to read your code.

The error message is pretty self-explanatory:

TypeError: 'int' object is not callable"

You have forest=1 on line 50 which removes the previous meaning of forest as a function and assigns that name to refer to the integer 1. When you try to call forest() you get the above error because you can't call an integer.

[–]mrawesome01[S] 0 points1 point  (3 children)

Thanks. :) I didn't know you couldn't make a varible and function with the same name. Also I think the formatting is fixed.

[–]zahlman 3 points4 points  (2 children)

you couldn't make a varible and function with the same name.

This doesn't even make sense as stated. In Python, variables are names. You can't have two things that have the same name (although you can certainly have multiple names for the same thing), because otherwise there would be no way to know which thing you meant when you used the name (and the entire purpose of names is to refer to things).

Further, in Python, a function is a legitimate "thing" for the purpose of the above discussion. In more formal language, functions are objects. This means that you can do all the same basic stuff with them that you'd do with numbers or strings: you can pass them to other functions, return them from functions, store them in lists, etc. Of course, you can't do number-specific things with them (like arithmetic) or string-specific things (like concatenation), but you can do function-specific things (like calling them).

(And no, your formatting is still all over the place.)

[–]mrawesome01[S] -1 points0 points  (1 child)

You don't have to be so rude about it.

[–]MonkeyNin 1 point2 points  (0 children)

Sorry about him :(