I want you to write a program that creates steps. You are expected to take in a single positive integer which will be used as the number of steps in your stair case. Validation The program only accepts integers greater than 0 and less than 1000. If 0 is entered, a message stating "Your staircase has no steps to build." should be returned If the user enters a value greater than or equal to 1000, a message stating "The staircase is too tall to build." should be returned. For all other values not within the valid range or not integers, a message stating "You have provided an invalid staircase size." should be returned. The program will always run only once for each user input. Tips for avoiding "Autograder Failed to Execute" The stairs or error messages need to be returned as a string from your createSteps() function. This is the function the autograder uses to test the output. The autograder does a conversion behind the scenes to convert the input value of numSteps to an int behind the scenes. If you are expecting it as a string, you will either need to "coerce" or "typecast" it back to a string via something like numSteps = str(numSteps) or change your code such that numSteps is always an int type. Do not rename the starter file. The autograder relies on the file having the given name of lab0.py. Don't put any critical code or definitions in the if __name__ == '__main__' block. Only use that if block for testing. Additional Requirements: 1. The very first step in the stair case will be left aligned and for each subsequent level the step will move above and to the right of the prior step. 2. There are no spaces after the right of any of the steps. 3. The bottom most row ends without a new line.
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
I want you to write a
Validation
- The program only accepts integers greater than 0 and less than 1000.
- If 0 is entered, a message stating "Your staircase has no steps to build." should be returned
- If the user enters a value greater than or equal to 1000, a message stating "The staircase is too tall to build." should be returned.
- For all other values not within the valid range or not integers, a message stating "You have provided an invalid staircase size." should be returned.
The program will always run only once for each user input.
Tips for avoiding "Autograder Failed to Execute"
- The stairs or error messages need to be returned as a string from your createSteps() function. This is the function the autograder uses to test the output.
- The autograder does a conversion behind the scenes to convert the input value of numSteps to an int behind the scenes. If you are expecting it as a string, you will either need to "coerce" or "typecast" it back to a string via something like numSteps = str(numSteps) or change your code such that numSteps is always an int type.
- Do not rename the starter file. The autograder relies on the file having the given name of lab0.py.
- Don't put any critical code or definitions in the if __name__ == '__main__' block. Only use that if block for testing.
Additional Requirements:
1. The very first step in the stair case will be left aligned and for each subsequent level the step will move above and to the right of the prior step.
2. There are no spaces after the right of any of the steps.
3. The bottom most row ends without a new line.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps