Section 4.3 Step 10 - 11 Issue Resolved

The Question: Write a program that loops through the numbers between 1 and 40. If a number is divisible by 3, print Hip. If the number is divisible by 7, print Hooray.

No matter what I type in for this problem I still get the same output for everything. My original problem is below I have also played with the range to see if I would get a different result. I put in range (2,40) for the range and still ended up with the same answer I have also added the output below. No matter what I put in I still get the same answer.

Question 11 is similar to question 10 it is fill in the blank and whatever I put in for that part is always wrong as well. Maybe if I could get help on Question 10 it would help with Question 11.

I think you have to remember the contingency where the counter variable refers to both 3 AND 7.

Thank you for your help. I finally got the right output on Question 10, but when I input the numbers into Question 11 it is telling me the problem is wrong. Do you have any other suggestions that may help? I think my problem has to do with the range. It says between, so am I looking at numbers 2-39 or am I including 1 & 40 in the results because it does not really say include so I am unsure.

I would guess that, if the code asks for “between 1 and 40”, you try your best to create your range in just that way.

Maybe I am over thinking this question, but could you give me a break down of the logic because I can not see where I am going wrong.

Review 4.3 step 9 to see exactly how the range function works. It has a pretty good explanation.
Good Luck!

Thank you, I reread it, but I will do it again to see if I can get something different.

Thank you everyone who helped. I did not put in the quotes on the print statements in the fill in the blank, but I had them in the program. It worked.

This one stumped me for a bit as well.

If your range is 1-40

You have to put (1,41)

You always have to add 1 to the end of range number.