Nov-03-2020, 04:23 PM
(Nov-03-2020, 03:56 PM)DeaD_EyE Wrote: Hint: Use https://pypi.org/project/ipython/
You have to indent explicit by 4 spaces after thetry
and theexcept
:
>>> try: ... a = float(input('Enter a number: ')) ... except ValueError: ... print('You entered an invalid number') ... Enter a number: 3/4 You entered an invalid number >>>Same with IPython repl:
In [1]: try: ...: a = float(input('Enter a number: ')) ...: except ValueError: ...: print('You entered an invalid number') ...: Enter a number: 3/4 You entered an invalid number In [2]:The benefit here is, that the indentation for multiline is made automatically.
You don't have to hit 4 times the space, if you use IPython. Also Tabulator is converted into 4 spaces :-)
Thank you! Evidently I don't yet know how to run IDLE, so I tried PyCharm Edu and it ran ok. Thanks again1