B. try block
By using a try block, George can attempt to convert the user input to an integer and handle any potential errors that may arise, such as if the user enters letters instead of a number. This will prevent the program from crashing if unexpected input is received.
George is creationg 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 be used?
A. for loop
B. try block
C. ValueError signifier
D. trace table
1 answer