CS105: Unit 2 corrections, notes and suggestions

CS105: Introduction to Python
Sections
Unit 2: Operators

2.1: Arithmetic Operators …
5. Multiplication and Division
Reference Page id=29351&chapterid=4868

  • The output from the first code block results in the value 1011.0099999999999. While the correct product of 100.1 multiplied by 10.1 is indeed 1011.01, floating point math on computers has nuances. It may be worth explaining this and providing resources on the matter. Alternatively, perhaps using alternate values such as 100.1 * 1.1 can temporarily eliminate this complication altogether.

2.1: Arithmetic Operators …
6. Modulo
Reference Page id=29351&chapterid=4869

  • The second code block assigns values for variables q and r and then prints the result of expression o % p which was defined in the first code block above. The Output of 0.0 is desired, but incorrect. To rectify, change the print statement in the second code block to print(q % r)

2.1: Arithmetic Operators …
9. Assignment Operators
Reference Page id=29351&chapterid=4872

  • The commentary about the for loop in the second code block refers to multiplying the variable w by the number 2 and assigning the result in the variable w for the next iteration of the loop. While the first code block uses the variable w, this second code block actually uses the variable named x

  • The code block introduces indented code but does not give guidance to the learner on the importance of the indentation.


2.3: Relational and Logical Operators
The bool Data Type
Reference Page id=29359

  • The referenced YouTube video from dotcompile has an output error at 2:11. When comparing variables for x and y, the output is shown as True and False. The correct output should be False followed by True. This disparity is noted in the comments section when viewing the video on YouTube directly.

2.3: Relational and Logical Operators
Practice with Relational and Logical Operators
2. Comparison Operators
Reference Page id=29362&chapterid=4877

  • Several apparent code and output blocks do not appear to be properly formatted, but this shouldn’t be too problematic

  • The last code block introduces comments at the end of lines and could benefit by a prior explanation of what comments are


2.3: Relational and Logical Operators
Practice with Relational and Logical Operators
3. Logical Operators
Reference Page id=29362&chapterid=4878

  • Several apparent code and output blocks do not appear to be properly formatted, but this shouldn’t be too problematic

  • Code blocks on this page also make use of comments


2.3: Relational and Logical Operators
Practice with Relational and Logical Operators
5. Using Boolean Operators for Flow Control
Reference Page id=29362&chapterid=4880

  • The code block contains indented code but does not give guidance to the learner on the importance of the indentation.

2.4 Operator Precedence Revisited
Operators and Expressions
7. Expressions
Reference Page id=29364&chapterid=4891

  • When calling python from the command line and passing the expression.py file as an argument the use of ‘python’ may be ambiguous depending on what operating system is being used, default python installations. It may be appropriate to call /usr/bin/env python3 expression.py instead, which will use python3 in place of older and obsolete python2.

  • The commentary regarding Python pretty-prints the output including a space may actually be useful back in Unit 1, Section 1.5: Basic Python Output Using the print Function where the print statement is introduced (Reference page id=29252)

1 Like

Thanks! I’ve shared this with the team, along with your other post.