4.3 Step 11 Fill in the blank issue


#1

Hello,

Is someone able to look at my submission and tell me what I am doing wrong? I have entered the exact code into Repl and it runs correctly but I cant seem to find out what I am doing wrong.

Thank you,


#2

Going to post code to see if other can assist :slight_smile:

for number in range(1,41):
if number % 3 == 0:
print(“Hip”)
elif number % 7 == 0:
print(“Hooray”)


#3

The “elif” may not be useful. For example, it may be that the number is neither divisible by 3 or 7, so it’s not really an “elif” situation-- probably another “if”.


#4

@AlexC: There may also be numbers that are divisible by both 3 and 7. Your solution needs to account for that.


#5

Right. elif (else if) basically means “if the first thing isn’t true check to see if this new thing is true”. But it’s possible that both things could be true, so don’t use elif.