School assignment: Need help with Python HomeWork

Here are instructions: Create a new variable that is equal to 0
Create a while loop that adds 1 to the variable every cycle until the variable is equal to 10
Create an if statement in the loop to check if the variable is even or odd
Print the value of the variable, as well as whether the variable is even or odd

2 Likes

Hey there!

We can only point you in the right direction (as it’s homework). We can’t provide the full code.

Variable Creation

[VAR_NAME] = [VAR_VALUE]

While Loops

while [CONDITION]: # Change condition to an actual condition
  # Code, which would be adding [VAR_NAME] by 1 for you

If Statements

evenOrOdd = ""
if [CONDITION]:
  # Code, which would be checking if [VAR_NAME] is even or odd, and changing evenOrOdd to even or odd

Printing

print([VAR_NAME])
print("The number is " + evenOrOdd)

Please note that I mean [] as a placeholder, and you need to replace it with actual values. But in Python [] is a list.

Hope this helped :slight_smile:

6 Likes

Sorry, but we cannot directly help with homeworks, quoted from the replit’s community standards

You can seek help when you don’t know how to do it after tries, so try it yourself first.
The best we can do is to give minor hints, since this is a homework I’m sure your teacher taught you something about it, try using what you learnt instead of directly seeking for answers.

8 Likes

Hey there!

I already made an answer on your other topic. School assignment: Need help with Python HomeWork

In the future, avoid the creation of duplicate topics.

1 Like

I’ve merged the two topics and reworded the title so others are aware this is school work.

3 Likes