-
Notifications
You must be signed in to change notification settings - Fork 0
Include while loops and break and continue statements #9
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
Conversation
## Question {.smaller} | ||
* Write a loop that goes through the numbers 0 to 10 | ||
* For each number, print whether it is even or odd | ||
+ Hint: use the modulus operator `%` and `==` to check for evenness | ||
|
||
::: {.fragment .fade-in} | ||
```{python} | ||
#| echo: true | ||
#| output-location: fragment | ||
#| code-line-numbers: "|1|2,3|4,5|" | ||
for i in range(11): | ||
if i % 2 == 0: | ||
print(f"{i} is Even") | ||
else: | ||
print(f"{i} is Odd") | ||
``` | ||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to go after for loops I think
slides/basics.qmd
Outdated
::: | ||
|
||
|
||
## While loops {.smaller} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could while loops go after for loops?
Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
I've applied the changes you suggested and added a slide on usage of |
Description
What is this PR
Why is this PR needed?
Adds while loops, changes the order (now if else statements before the loops), adds break and continue statements, adds another exercise
How has this PR been tested?
Local build
Checklist: