Inside a for loop from 200 to 225 inclusive (includes both 200 and 225 values for even or odd), determine if each value is even or odd, like 1 is odd and 10 is even.

Use a Boolean variable like:
boolean myflag=true
Print out even or odd based on the boolean flag.

Use Modulo arithmetic (remainder) to determine if the value is even or odd. C++, Java, and Python all use the % character.
Divide the number (r in your loop counter) by 2
If the remainder is 0, then the number is even, else it is odd
If the remainder is zero, set your boolean value to true, else set the boolean value to false, like:
boolean myflag=true where myflag is any variable name
Notice, no quotes around true.

In Python, the T in true is a capital T...print something like:
if (myflag)
Note: You don't have to check to see if myflag==true

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

myflag = True

for i in range(200, 256):

    myflag = i % 2 == 0 # Check if mod division is equal to zero a set result to myflag

    if myflag:...

By purchasing this solution you'll be able to access the following files:

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats