diff --git a/README.md b/README.md index 194e955..0b8646a 100644 --- a/README.md +++ b/README.md @@ -71,10 +71,10 @@ |Name|Objective & Instructions|Solution|Comments| |--------|--------|------|----| -| Hello World! | [Exercise](exercises/hello_world/hello_world.md) | Solution](solutions/hello_world/hello_world.md | | +| Hello World! | [Exercise](exercises/hello_world/hello_world.md) | [Solution](solutions/hello_world/hello_world.md | | | Python Characteristics | [Exercise](exercises/hello_world/python_characteristics.md) | [Solution](solutions/hello_world/python_characteristics.md) | | | What is the result? - Level 1 | [Exercise](exercises/hello_world/what_is_the_result_lvl_1.md) | [Solution](solutions/hello_world/what_is_the_result_lvl_1.md) | | -| What is the result? - Level 2 | [Exercise](exercises/hello_world/what_is_the_result_lvl_2.md) | | | +| What is the result? - Level 2 | [Exercise](exercises/hello_world/what_is_the_result_lvl_2.md) | [Solution](solutions/hello_world/what_is_the_result_lvl_2.md) | | ## Objects & Data Types @@ -1644,4 +1644,4 @@ def home(): return 'main website' app.add_url_rule('/', view_func=home) -``` \ No newline at end of file +``` diff --git a/solutions/hello_world/what_is_the_result_lvl_2.md b/solutions/hello_world/what_is_the_result_lvl_2.md new file mode 100644 index 0000000..3a9936c --- /dev/null +++ b/solutions/hello_world/what_is_the_result_lvl_2.md @@ -0,0 +1,13 @@ +## What is the result? - Level 2 + +1. What is the result of each of the following statements? Explain why. + + * `"" == " "` - False \ + The space between double quotations is whitespace sensitive. The left side corresponds to an empty string of no characters while the right side corresponds to a single whitespace element + + * `'two' > 'three'` - True \ + The values being compared here are of a type `string`, so the comparison operator will perform an element-wise comparison of each character in each of the items using their unicode order. For the first element, `'t'` and `'t'` are compared and found to be equal. Next, the second values, `'w'` and `'h'` are compared. And since the unicode value of `'w'` is higher than that of `'h'`, python will halt the comparison there and return the comparison as `True` + + + * `[] == []` - True \ + This is a comparison of two empty lists, and since the types are the same and both have no elements, they are equated to be the same