Joe-Heffer-Shef / FAIR4RS-Documentation

This is a course on software documentation for researchers developed by the Research Software Engineering team and IT Services at the University of Sheffield.
https://joe-heffer-shef.github.io/FAIR4RS-Documentation/
Other
0 stars 1 forks source link

Clarify language for challenge in Code Readability #24

Open ns-rse opened 1 week ago

ns-rse commented 1 week ago

The challenge at the end of this episode tests the function add() but its focused on Python since the solution indicates that it won't return an error which is true, in Python the + can be used to concatenate two strings...

In [1]: "cheese" + "cake"
Out[3]: 'cheesecake'

But the material covers R as well and the behaviour is different in this language since the binary operator requires numeric arguments...

> "cheese" + "cake"
Error in "cheese" + "cake" : non-numeric argument to binary operator

Perhaps worth clarifying that the example is being run in Python.

Alternatively could cover answers for both languages indicating no error is raised if run in Python, but that R does raise an error.