Instead of just checking for one character (like the "!" in the previous suggestion), in this task you should look for several specific characters.
for loops, if statements with multiple conditions (or), and "accumulator" variables (e.g., count = count + 1).This is the ultimate test of if/elif/else logic. It doesn't require complex loops, but it requires "nested" logic (if inside an if).
if statements to determine the winner.This moves away from strings and focuses on the relationship between loops and numbers.
The Task: Ask the user for a number (e.g., 20). The program should loop from 1 to that number and:
Print whether each number is "Even" or "Odd".
At the very end, print the sum of all the even numbers it found.
Concepts: range(), the modulo operator % (to check for even numbers), and keeping a running total.
The "Aha!" Moment: Using a loop to do math that would be tedious to do by hand.
| Assignment | Primary Focus | New Skill |
|---|---|---|
| Vowel Counter | for loops |
Using a variable to "keep track" of a count. |
| Rock, Paper, Scissors | if / elif / else |
Organizing complex logic/rules. |
| Even-Odd Sum | range() + Math |
Using % 2 == 0 to identify patterns. |