Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

urgent, could you please help me with these questions ? thanks This code has a syntax problem related to the exception catching: def broken_code(my_string): split_string

urgent, could you please help me with these questions ? thanks
image text in transcribed
image text in transcribed
This code has a syntax problem related to the exception catching: def broken_code(my_string): split_string = my_string.split(",") return split_string[0] except Exception as ex: print("Unable to split string + split_string) What is the problem? Select one O a. There is no try block - our try/except structure requires both a try and an except block. b. In the except block we must name the exception as 'e' not as 'ex' c. The code does not specify the kind of exception to catch d. There is no return statement in the except block. we need to have returns both inside and outside the except block Trun the following code, and when prompted to enter an integer', type in the word "banana' - what happens next? def prompt_the_user(): response = "" while response == ": try: response = input("Enter an integer: ") int_value = int(response) print("Your number multiplied by two is: " + str(int_value*2)) except Exception as e: print("That value wasn't acceptable, because of an exception: " + strie response = prompt_the_user() Select one a. The code prints That value wasn't acceptable, because of an exception: invalid literal for into with base 10. "banana' And then exits gracefully b The code exits with a runtime error

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

EXPLAIN how to develop an orientation program.

Answered: 1 week ago

Question

2. Why has the conflict escalated?

Answered: 1 week ago

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago