-1

I got the following error for my code. Can anyone help me pls.

code is as follows

def askforinteger():
    while True:
        try:
            a = int(input("enter an integer")
        except Exception as e :
            print("there is a error of", e)
        else:
            print("person has entered correct input")
            break
        finally:
            print("clsoe this issue")

Error is as follows

  File "<ipython-input-5-234fd49c196d>", line 5
    except Exception as e :
    ^
SyntaxError: invalid syntax
Omkar76
  • 1,317
  • 1
  • 8
  • 22
Shirishg
  • 11
  • 1
  • 1

1 Answers1

0

you have error syntax :

you forget to add bracket in a attribute

hope this will fix it try this out :

  def askforinteger(): 
        while True: 
            try: 
                a = int(input("Enter a number: "))
                print("person has entered correct input") 
            except Exception as e : 
                print("there is a error of", e)     
                break 
            finally: 
                        print("clsoe this issue")
Ahmad Akel Omar
  • 317
  • 2
  • 11