Section 4.3 step 11

4-3
module-4

#25

Thanks I got! My range of numbers was wrong.


#26

i cant seem to get this correct for anything. I have 5 failed attempts

Edit: per our posting guidelines, please do not post significant amounts of code or solutions outside of private mesaages. Thanks!


#27

Remember that a range (a,b) does not include the number for b, but rather (b-1).


#28

I understand the range and the use of the modulus but somehow I am still not getting it. I’m confused as to how to include both of them. When you ask about indenting I don’t know how I would do that.


#29

Indenting happens with 4 presses of the space bar. It is used, among other things, to designate code within a loop. You might try using the modulus function within a loop defined by the range function.


#30

For this problem, you’re working in fill-in-the-blanks, so you don’t have to worry about indenting. If you’re sure about how you’re using range and modulus, the other spots I see people tripping up are the conditional for hooray and the printing syntax.

Try copying and pasting your best guess into the previous step’s repl.it and see what it prints out; if you get an error message, that should point you in the right direction of what to fix, otherwise, compare your output to the expected output below that terminal window and see if they match. If they don’t match, walk through each number and see where the difference could be coming up.


#31

Can someone give me a hand? I am not sure where I am making my mistake :frowning

Never mind I got it! :slight_smile: :


#32

Even i failed more than 10 times…but your concept of changing the range worked. thanks


#33

I’m absolutely stuck on this step. Can someone please walk me through it? Thanks


#34

Some common sticking points: 1. If a “range” is used, please remember that it does not include the last number listed. ie ( for elem in range (1,35) would NOT include 35, but would end at 34. That trips lots of folks up. Also, remember how a modulus (%) function works-- if 2 is a factor of, for example, 8, then ( 8 % 2 ) == 0.


#35

Hello! I’m also getting an error on Section 4.3 step 11. I used the same code that I did in 4.3 step 10 and got the code to successfully run with “Hip Hip Hooray” continuously as the output. However, when I filled in the blanks on step 11 I keep getting incorrect answers.

the code I wrote was:

code removed, please do not paste large sections of code

Again, when I put this code into 4.3 Step 10, I get the correct output without any syntax errors, however when I fill in the blanks on Step 11. I keep getting the wrong answer. Can anyone advise me? Trying to get finished by tonight! Thank you!


#36

I think the only difference between mine and yours is for number in range() I actually put three numbers in it, the last one was how much I wanted increment per loop. I don’t know if it makes any difference for this one.


#37

Thanks for the reply! I figured it out. I had to change it to 1 in the beginning of the range. Which is what I originally had, but I didn’t have the “” around Hip and Hooray the first few thousand times


#39

Thanks, Adam! This helped. I was so frustrated because my code was working, but I couldn’t get the right answer for the fill in the blanks.


#40

I cannot get this not matter what I try… if 13% are getting it correct on the first try, maybe it’s a bad question


#42

This fixed my problem. I got quite a few incorrect submissions this module. Glad to see I wasn’t the only one.