Create a for-loop that loops from 0 up to and including 20. On each iteration, output a '*' (an asterisk) if the value of the counter variable is divisible by 2, a '@' if divisible by 3, and a '$' if divisible by 4. In all other cases, output a '!'. Each symbol should be printed on a different line.
for i in range(21):
if i % 2:
print("*")
if i % 3:
print("@")
elif i % 4:
print("$")
else:
print("!")
print(i)
Comments
Leave a comment