nerdexam
GIAC

GPYC · Question #12

Review the following Python 3 code. while True: try: n = input("Enter a number: ") n = int(n) break except ValueError: print("Not an integer") print("Thank you")

Sign in or unlock GPYC to reveal the answer and full explanation for question #12. The question stem and answer options stay visible for context.

Python Fundamentals & Command Line Tools

Question

Review the following Python 3 code. while True: try: n = input("Enter a number: ") n = int(n) break except ValueError: print("Not an integer") print("Thank you")

Options

  • A539
  • B4a6e
  • C(52-4)
  • Dthree

Unlock GPYC to see the answer

You've previewed enough free GPYC questions. Unlock GPYC for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#try/except#input validation#type conversion#while loop
Full GPYC Practice