Reputation: 3
enter image description here Why it's showing an Error
try: file = open("main.py") age = int(input("Enter age: ")) except (ValueError, ZeroDivisionError): print("Enter valid Number") else: print("How are you?") finally: file.close()
Upvotes: 0
Views: 294
Reputation: 161
Instead of open, try with open, and remove the finally statement with the close. This will automatically close it.
Upvotes: 2