Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Episode 1 - BODMAS - Knowledge #627

Open
sihart25 opened this issue Mar 5, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@sihart25
Copy link

commented Mar 5, 2019

In the first lesson Variables:

Any Python interpreter can be used as a calculator:

3 + 5 * 4

If we are introducing new syntax/programming concepts do we need to get people to think about Mathematical operator order of precedence as well? and in a way knowledge of the python operator order of precedence.

@annefou

This comment has been minimized.

Copy link
Collaborator

commented Mar 5, 2019

Python's operator precedence rules mirror those in mathematics. I don't know if adding this information would be helpful or add possible confusion.

@sihart25

This comment has been minimized.

Copy link
Author

commented Mar 5, 2019

true adding the extra could create extra confusion so would the example be better as say
3 + 5
Avoiding any unintended inference to operator precedence or would this remove the idea of combining operations?

@maxim-belkin

This comment has been minimized.

Copy link
Collaborator

commented Mar 5, 2019

Hi @sihart25 and welcome to our repository!
Using 3 + 5 * 4 as an example in the introduction serves two purposes: 1) convey the fact that Python interpreter can be used as a "calculator" 2) It follows standard mathematical rules. As with any lesson out there, we have to draw a borderline somewhere and this is the case here: if the order of mathematical operations is a problem, then this lesson is not the right lesson to start with (SWC lessons are for beginning scientists). We also don't mention other operations (such as exponentiation, which is ** and not ^, which is a bitwise XOR) for the same reason: this is not the goal here. Here we just want to say that you can do math in Python interpreter and quickly transition to variables.

@Ovo-Akpome1

This comment has been minimized.

Copy link

commented Mar 20, 2019

I think it is important to introduce the concept of BODMAS, but not in a confusing way. They should tell the participants that when python does mathematical operations, it follow the law of BODMAS.Therefore, they do not have to write an extra command to specify the order of the mathematical operation to get the correct answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.