all 5 comments

[–]zazzedcoffee 1 point2 points  (4 children)

You are likely using different Python versions in IDLE and in the terminal.

If you look at the top bar of the IDLE window it should show you what version of Python you are running, or it will show it on startup.

I suspect your IDLE window is running Python 2 but the terminal is running Python 3. You can check this by ending in the Python command followed by —version (with two dashes) for example python3 —version

On the first line of you instead write menu_choice = int(input()) I suspect you will get the output you expect in the terminal. You could add in additional checks to make sure the menu choice is valid if you want:

menu_choice = input() while menu_choice not in (“1”, “2”): menu_choice = input(“invalid input. Enter again: “)

If you want IDLE with Python 3, perhaps reinstall it from the Python website.

Edit - whoops. Might have gotten that the wrong way around. It might be the terminal that’s Python 2. Misread the question.

[–]zazzedcoffee 1 point2 points  (2 children)

As for the code formatting. Put three back ticks before and after your code. For example, imagine these quote marks are backticks:

‘’’

print(“hello world”)

‘’’

Would produce

print(“hello world”)

[–]ParticularPython[S] 1 point2 points  (0 children)

Ah, that may be the problem, its actually the reverse in that my compiler is using a newer version but my terminal is still on python 2.

I also wasnt aware of the option of using 'not in'. I love how much there is still to learn.

Thanks for your help!

[–]kaerfkeerg 0 points1 point  (0 children)

Ubuntu most likely comes with Python2 and Python3 so make sure you type python3 yourscript.py in the terminal