This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CS1101 - Discussion Forum Unit 4 | |
# Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working. | |
# ✓ Define "precondition" and "postcondition" as part of your description. (First two paragraphs) | |
# ✓ Describe each possibility in your own words. (All three paragraphs) | |
# A precondtion is a problem before the function’s arguments are passed into the parameters (Downey, A. 2015). Are there arguments being passed? Sometimes a function is called a long ways away from where it’s defined. With languages like Python it’s often critical to name parameters effectively so that the correct arguments are passed. This can be as simple as missing a type e.g. ‘5’ instead of 5. | |
# A postcondition is a problem that follows from the point immediately following the arguments being passed (Downey, A. 2015). A really simple example could be `function (a, b) { b -a }`. No matter the language we can all see how it’s unlikely that a human mind would order the parameters as a follow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Describe the difference between a chained conditional and a nested conditional. Give your own example of each. Do not copy examples from the textbook. | |
Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional. Do not copy the example from the textbook. | |
✓ Describe the difference between a chained conditional and a nested conditional. | |
✓ Give your own example of each. | |
✓ Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional. | |
✓ Describe a strategy for avoiding nested conditionals (bottom). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
<component name="TestRunnerService"> | |
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |
</component> |