Having learned about the 'if' statement in Python, you are now progressing towards a Python function that prints whether numbers from 1 to 10 inclusive are even or odd. For this, fill the blanks in the given code to make use of the concept of a 'while' loop along with the 'if' statement you learned earlier. The output should be in the format 'n is even' or 'n is odd', for each number from 1 to 10 inclusive.
Creating a function to classify numbers as even or odd
Report a typo
Fill in the gaps with the relevant elements
counter = 1
counter <= 10:
counter % 2 == 0:
print(str(counter) + " is even")
:
print(str(counter) + " is odd")
counter += 1Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.