swcarpentry / python-novice-gapminder

Plotting and Programming in Python
http://swcarpentry.github.io/python-novice-gapminder/
Other
163 stars 428 forks source link

Assignment & Concatenation - potential clarifications #605

Open Cook4986 opened 2 years ago

Cook4986 commented 2 years ago

Regarding the lesson Plotting and Programming in Python:

Assignment Ordering

As a novice coder, it’s tempting to see the = character in a variable assignment statement (e.g. num = 6) as representing arithmetical identity. So, interchangeability characterizes the = notation that many novice programmers will have encountered before. This can lead to problems associated with erroneously switching the left/right position of the declared variable and the assigned value. The addition of a brief note reinforcing assignment ordering rigidity could be valuable.

Printing vs. Concatenating

Within the same lesson, there are multi-argument print calls (“Use print to display values” sub-section) that combine variables via , notation. In the subsequent lesson Data Types and Type Conversion, print function concatenation is demonstrated using the + notation. The addition of a note differentiating simple printing vs. concatenation might be useful for novice coders (like me).

Happy to pull and update, if these additional notes/clarifications make sense. Thanks!

martinosorb commented 1 year ago

Hi @Cook4986 , thank you for the comment and sorry for the much delayed reply, I'm going through some old issues. I don't disagree with either of your comments, do you have ideas on how to fix those?