RECODE 2: We have just coded Condition 1. Let's connect it to Condition 2 with the correct logical operator.

  • Edit the if statement that we just created by placing the logical operator or before the colon.
  • After the or, include this condition: year % 400 == 0. This represents condition_2!
  • From , drag Else under the if statement. Make sure it is not indented!
  • From , drag Print String into the else-block. Change it to "That is not a leap year."

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)