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

More explanation of modulo #424

Open
maneesha opened this issue Dec 10, 2019 · 4 comments
Open

More explanation of modulo #424

maneesha opened this issue Dec 10, 2019 · 4 comments
Labels
good first issue Good issue for first-time contributors

Comments

@maneesha
Copy link
Contributor

The episode Short Introduction to Programming in Python notes that

We can perform mathematical calculations in Python using the basic operators +, -, /, *, %:

I don't think most people would consider modulo to be a basic operator. I would recommend some more explanation of what modulo does.

@maxim-belkin
Copy link
Contributor

I don't think most people would consider modulo to be a basic operator.

I agree. Would dropping it here be a reasonable alternative to explaining it?

@maneesha
Copy link
Contributor Author

Either way would work from my perspective. It could be useful to know, so it may be worth introducing. However, that may make this lesson longer so I'm fine dropping it as well.

@nettic
Copy link

nettic commented Feb 17, 2020

There is a good example which shows either both of things which I miss here: the if/else statement and the example for modulo:

There is one common use for the Modulo Operator: to find even or odd numbers eg in a range 1 to 10:

for number in range(1, 10):
    if(number % 2 != 0):
        print(number)

The lesson shows the boolean type but no example for the usage. If/else condition would be helpful to introduce at this point. Thus, both topics are great to include here.

@gnguyen27
Copy link

gnguyen27 commented Feb 17, 2020

I would suggest to add the example of finding even or odd numbers where we introduced a list.

https://datacarpentry.org/python-ecology-lesson/01-short-introduction-to-Python/#lists

gnguyen27 added a commit to gnguyen27/python-ecology-lesson that referenced this issue Feb 17, 2020
@quist00 quist00 added the good first issue Good issue for first-time contributors label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for first-time contributors
Projects
None yet
Development

No branches or pull requests

5 participants