Vidyalelo
Python · Q45

Exception Handling in Python

Programming · Python · question 45

Q45

What will be the output of the following Python code if the input entered is 6? valid = False while not valid: try: n=int(input("Enter a number")) while n%2==0: print("Bye") valid = True except ValueError: print("Invalid")

A.
Bye (printed once)
B.
No output
C.
Invalid (printed once)
D.
Bye (printed infinite number of times)
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board