Question: he code snippets below consist of a function that takes two numbers as an input ( initially strings ) and then checks whether the second

he code snippets below consist of a function that takes two numbers as an input (initially strings) and then checks whether the second number is a multiple of the first number.
# A program which checks if num_2 is a multiple of num_1
def check_if_multiple():
try:
num_1= int(input('Enter first number: '))
num_2= int(input('Enter first number: '))
if num_2% num_1==0:
print('True')
else:
print('False')
except Exception as obj:
print('Generic Exception Handler')
except ValueError as obj:
print('Expected Integer input')
print('__!String value founded!__')
Now, lets say a user gave the input for num_1 and num_2 as '12' and Steve, respectively. What will the output be?
The code will successfully run and show the following output:
Expected Integer input
__!String value founded!__
The program will crash because we are giving a string for the integer input.
The code will successfully run and show the following output:
Generic Exception Handler
The code will successfully run and show the output below:
False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!