Menu

Try and Throw - Code Quiz

1. What is printed?

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

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)
True
0
ten
False

Log in or sign-up to access the quiz



Don't have a login?

You can still revise this topic