4.3 12 Fill in the Blank Question

Hi.
I am having trouble with this fill in the blank question. I feel like maybe you can’t put two for loops right after each other? The 4th space is the only part I don’t feel confident in my answer but I’m not sure. Please help!
Thanks,
Denise

Denise,

You are able to put one loop after another (or even nest them inside one another).

So, for each number in that range, you are checking for 2 things, and they are quite similar, yes?

One is if the number is divisible by 3, and the other is if it is divisible by 7. . . so. . . how should these codes look the same? How different?

Denise,

As Msytified said you CAN put two loops right after each other or nest them. However, the fill in the blank question is asking for it a little differently.

You are needing to loop through a range number numbers and check to see if each number meets 1 of 2 conditions (IF statements). If a number meets one of the conditions, print the message for that condition. Then move onto the next number.

The first blank is setting the range of numbers that you would like to loop through. Remember that the last number in the range is not included. So if wanted to loop though 1,2,3,4,5…your range would be 1-6.

Next you are setting your two conditionals. IF a number is divisible by 3 or IF a number is divisible by 7, it will send a message . To check if a number is divisible by another number you will need to use the right OPERATOR.

Example:
If the remainder of NUMBER divided by 3 is 0. Then that number is divisible by 3.

ok I feel like I am putting in the right answers but still not getting it wrong, can I say exactly what I put in the answer boxes or are we not supposed to do that? It’s hard to communicate where I’m going wrong without saying what I think the right answers are. I think my range is correct and my operator is correct and I put quotations around the string portions but still not getting it right

The posting guidelines state “but as a general rule, Discovery and Unit 1 Questions should avoid having more than one line of pure code posted.”

So if you want to send me the one line you think you are having troubles with I would be happy to look at it.

ok I sent you a message

Just to give a quick update. Denise already figured out the right answers for this question, but the website does not seem to be accepting them.

She has tried multiple devices and chrome (incognito mode). Recommended reaching out to the launchcode staff and/or stepik support to assist

I’m having the same problem with this question. I’ve tried everything but it keeps telling me I’m wrong

Denise change your range to (1,41). It works

I finally just entered my answers on a computer with windows and it worked. I was trying it on a mac and the app on my phone and it wouldn’t work. Are you using a mac?

No I’m using Windows

I was having a hard time with this one. Then when I got the right answer, I realized that there is only one right answer.

So to help some others with some info i didn’t have:

The range was talked about and important above.

The output is case sensitive.

It only accepts one type of quotes, double or single.

Last and most important for me is that an IF statement does not need an ELIF or ELSE following it.

Hope that helps for anyone else with problems.

1 Like