fork download
  1. try:
  2. n=int(input("Enter the number:"))
  3. result=10/n
  4. except ValueError:
  5. print("invalid input")
  6. except ZeroDivisionError:
  7. print("cannot divide by zero")
  8. else:
  9. print("result:",result)
  10.  
Success #stdin #stdout 0.03s 9812KB
stdin
Hello
stdout
Enter the number:invalid input