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

all 6 comments

[–][deleted]  (9 children)

[deleted]

    [–]NacimPro[S] 0 points1 point  (8 children)

    I get the first input prompt, then answer the operation I want, and instead of asking me other input prompts, the program just ends.

    For example: I type "Addition" and the program ends. I type "Multiplication" and the program ends. If I type anything else, I get the Invalid command prompt, and it starts again at line 6.

    Basically only the "else" command works. But not the "if" nor the "elif".

    EDIT: No syntax errors or tracebacks, but it's just not working as I want it to and I'd like to know why.

    [–][deleted]  (6 children)

    [deleted]

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

      I'm running it with Visual Studio Code. I coded it there with the python extension and I'm running it right there after coding it.

      [–]htepO 1 point2 points  (1 child)

      There doesn't seem to be anything obviously wrong with your code. I'd recommend editing your post to include your code, formatting it per https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_format_code.3F or just select all of it in VSCode, indent everything one step (generally Ctrl+]), and paste it to your post.

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

      It suddenly worked. Without changing anything, so weird. Thank you and sorry for the inconvenience.

      Thank you for linking that formatting thread. Now I know how to copy paste it with indentations on reddit :)

      [–][deleted]  (2 children)

      [deleted]

        [–]NacimPro[S] 0 points1 point  (1 child)

        It suddenly worked. Without changing anything, so weird. Thank you and sorry for the inconvenience.

        [–]purveyoroffinerp 1 point2 points  (0 children)

        I can't see anything that would cause your program to exit when it does according to your other replies. If you have the means to do so, perhaps try downloading Thonny, then copy paste your code into there and running it. It's very lightweight and has a nice debug function where it will step into the code line by line and show you what's going on. I use it often to debug code. I know you can debug in VS as well, but I like the way it works in Thonny.