1. Format your code as provided in the Lab 2 Start Code provided below. 2. The user prompt for a size will be: "Please input your stair case size:" 3. Perform a function call within the exception handling logic (Your function that contains the code to run the program should be within a try/except block - see comments in the starter code). 4. Raise and Handle the following exceptions: A custom exception called "IntegerOutOfRangeException" when the user provides an integer value that is not within the valid integer range. ("That staircase size is out of range.") - A custom exception called "NoStairCaseException" when the user provides a staircase size of 0. ("There are no steps in the staircase.") - In ValueError for user input that are not integers. ("There are no steps in the staircase.") 5. The error messages for the above exceptions should be the same as above and printed to the shell. 6. The program should continue to run and request a new input until the user types the word "DONE" 7. Use this start code to being your project. You can use your code from lab1. (Only your code not anyone else's).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Python.

1.  Format your code as provided in the Lab 2 Start Code provided below.

2. The user prompt for a size will be: "Please input your staircase size:"

3. Perform a function call within the exception handling logic (Your function that contains the code to run the program should be within a try/except block - see comments in the starter code).

4. Raise and Handle the following exceptions:

       - A custom exception called "IntegerOutOfRangeException" when the user provides an integer value that is not within the valid integer range.  ("That staircase size is out of range.")

       - A custom exception called "NoStairCaseException" when the user provides a staircase size of 0. ("There are no steps in the staircase.")

      - In ValueError for user input that are not integers. ("There are no steps in the staircase.")

5. The error messages for the above exceptions should be the same as above and printed to the shell.

6. The program should continue to run and request a new input until the user types the word "DONE"

Please input your stair case size: 1
+-+
+-+
Please input your stair case size: 3
+-+
| |
+-+-+
| |
+-+-+
| |
+-+
Please input your stair case size: 5
+-+
%3D
+-+-+
| |
+-+-+
+-+-+
| |
+-+-+
| |
+-+
-
Transcribed Image Text:Please input your stair case size: 1 +-+ +-+ Please input your stair case size: 3 +-+ | | +-+-+ | | +-+-+ | | +-+ Please input your stair case size: 5 +-+ %3D +-+-+ | | +-+-+ +-+-+ | | +-+-+ | | +-+ -
1. Format your code as provided in the Lab 2 Start Code provided below.
2. The user prompt for a size will be: "Please input your stair case size:"
3. Perform a function call within the exception handling logic (Your function that contains the code to run the program should be within a
try/except block - see comments in the starter code).
4. Raise and Handle the following exceptions:
A custom exception called "IntegerOutOfRangeException" when the user provides an integer value that is not within the valid integer
range. ("That staircase size is out of range.")
- A custom exception called "NoStairCaseException" when the user provides a staircase size of 0. ("There are no steps in the staircase.")
- In ValueError for user input that are not integers. ("There are no steps in the staircase.")
5. The error messages for the above exceptions should be the same as above and printed to the shell.
6. The program should continue to run and request a new input until the user types the word "DONE"
7. Use this start code to being your project. You can use your code from lab1. (Only your code not anyone else's).
1
" This functions asks the user for the number of steps
94 A7 X4 ^ v
they want to climb, gets the value provided by the user
and returns it to the calling function. This function will
Araise any exceptions related to none integer user inputs.
4
def getUserInput():
6.
#your code belongs here
7
8
'' This function takes the number of steps as an unput parameter,
6.
creates a string that contains the entire steps based on the user input
10
and returns the steps string to the calling function. This function will raise
11
any exceptions resulting from invalid integer values.
12
13
def printSteps(stepCount):
14
#your code belongs here
15
''This function kicks off the running of your program. Once it starts
it will continuosly run your program until the user explicitly chooses to
16
17
18
end the running of the program based on the requirements. Thie function returns
19
the string "Done Executing" when it ends. Addtionally, all exceptions will be
20
Ahandled (caught) within this function.
21
def runProgram():
22
#your code belongs here
23
24
'''Within this condition statement you are to write the code that kicks off
25
your program. When testing your code the code below this
should be the only code not in a function and must be within the if
Astatement. I will explain this if statement later in the course. !"
26
27
if -_name__ == "__main__":
%3D
28
29
#your code belongs here
30
31
32
33
Transcribed Image Text:1. Format your code as provided in the Lab 2 Start Code provided below. 2. The user prompt for a size will be: "Please input your stair case size:" 3. Perform a function call within the exception handling logic (Your function that contains the code to run the program should be within a try/except block - see comments in the starter code). 4. Raise and Handle the following exceptions: A custom exception called "IntegerOutOfRangeException" when the user provides an integer value that is not within the valid integer range. ("That staircase size is out of range.") - A custom exception called "NoStairCaseException" when the user provides a staircase size of 0. ("There are no steps in the staircase.") - In ValueError for user input that are not integers. ("There are no steps in the staircase.") 5. The error messages for the above exceptions should be the same as above and printed to the shell. 6. The program should continue to run and request a new input until the user types the word "DONE" 7. Use this start code to being your project. You can use your code from lab1. (Only your code not anyone else's). 1 " This functions asks the user for the number of steps 94 A7 X4 ^ v they want to climb, gets the value provided by the user and returns it to the calling function. This function will Araise any exceptions related to none integer user inputs. 4 def getUserInput(): 6. #your code belongs here 7 8 '' This function takes the number of steps as an unput parameter, 6. creates a string that contains the entire steps based on the user input 10 and returns the steps string to the calling function. This function will raise 11 any exceptions resulting from invalid integer values. 12 13 def printSteps(stepCount): 14 #your code belongs here 15 ''This function kicks off the running of your program. Once it starts it will continuosly run your program until the user explicitly chooses to 16 17 18 end the running of the program based on the requirements. Thie function returns 19 the string "Done Executing" when it ends. Addtionally, all exceptions will be 20 Ahandled (caught) within this function. 21 def runProgram(): 22 #your code belongs here 23 24 '''Within this condition statement you are to write the code that kicks off 25 your program. When testing your code the code below this should be the only code not in a function and must be within the if Astatement. I will explain this if statement later in the course. !" 26 27 if -_name__ == "__main__": %3D 28 29 #your code belongs here 30 31 32 33
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education