Menu

Try and Throw - Code Quiz

1. What is printed?

try: number = int('hello') print('Valid') except ValueError: print('Invalid')
Invalid
Valid
ValueError
hello

2. What is the value of valid after the code runs?

valid = False try: number = int('ten') valid = True except ValueError: valid = False print(valid)
ten
False
True
0

Log in or sign-up to access the quiz



Don't have a login?

You can still revise this topic