Shreyas arya

Generation

generate functionFri, 10 Feb 2023

Create a method to throw an exception if does not print a string

Script def foo(s): n = int(s) if n==0: raise ValueError('invalid value: %s' % s) return 10 / n def bar(): try: foo('0') except ValueError as e: print('ValueError!') raise bar()

Questions about programming?Chat with your personal AI assistant