60.3k views
2 votes
Write a program that prints the numbers 1 - 50. If the number is even print the word 'EVEN!' next to it. If the number is odd print the word 'ODD!' next to it.

1 Answer

2 votes

In python 3.8:

for x in range(1,51):

print(str(x)+" EVEN!" if x %2==0 else str(x)+" ODD!")

This works for me. Best of luck.

User Hicham Zouarhi
by
5.7k points