Nov-03-2020, 03:15 PM
Hello, I'm scratching my head trying to get the code in the book Doing Math With Python by Amit Saha on page 9 to work.
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
Regards,
David
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>> from fractions import Fraction >>> try: a = float(input('Enter a number: ')) #keyword except doesn't un-indent, I have to force it with a backspace except ValueError: print('You entered an invalid number') Enter a number 3/4 SyntaxError: invalid syntax >>>What am I doing wrong? Wrong python version?
Regards,
David