B. try block
Using a try block allows George to catch any errors that may occur when the user enters letters instead of a number, preventing the program from crashing.
George is creating a program that will ask the user to input their grade in school. George wants to prevent the program crashing if the user enters letters instead of a number. Which of the following can used?
A. for loop
B. try block
C. ValueError signifier
D. trace table
1 answer