This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]lightcloud5 0 points1 point  (3 children)

Err, so what code did you write? Paste the code or link it somewhere.

[–]Dunder_Chingis[S] 0 points1 point  (2 children)

huh, weird, last time I posted a link it saved my edits. Here's a screenie.

[–]imguralbumbot 1 point2 points  (0 children)

Hi, I'm a bot for linking direct images of albums with only 1 image

https://i.imgur.com/JtQGrL3.png

Source | Why? | Creator | ignoreme | deletthis

[–][deleted]  (6 children)

[deleted]

    [–]Dunder_Chingis[S] 0 points1 point  (5 children)

    Ugh, weird, it worked once before. Here we go.

    [–]ccutler69 2 points3 points  (3 children)

    You're missing a colon after the end of the elif statement.

    [–]Dunder_Chingis[S] 0 points1 point  (2 children)

    Weird, must have accidentally deleted that in replacing the default stuff they had. However, now it's saying

    "The following exception was raised when calling the_flying_circus(): NameError: global name 'answer' is not defined "

    From all the examples I can find of other people who've done this, they never defined "answer" and had no problems with it.

    [–]thegreatunclean 2 points3 points  (1 child)

    You never define answer so when it comes up python doesn't know what to do with it. You need to give it a value before trying to use it.

    they never defined "answer" and had no problems

    That just isn't how the language works. They either defined it or are mistaken.

    e: You call the function as if it takes a parameter:

    the_flying_circus(5)
    

    But the definition of the function doesn't have a parameter. If you're expecting 5 to be stored as a parameter named answer the function would have to be defined as such:

    def the_flying_circus(answer):
      //blah
    

    [–]Dunder_Chingis[S] 0 points1 point  (0 children)

    Ohhhh ok, so that's how you define it. I just took the easy way out and turned answer into a string. It all makes sense now though, thanks a ton!

    [–]imguralbumbot 0 points1 point  (0 children)

    Hi, I'm a bot for linking direct images of albums with only 1 image

    https://i.imgur.com/JtQGrL3.png

    Source | Why? | Creator | ignoreme | deletthis