Section 4.3 step 11

4-3
module-4

#1

Hello!

I created a code in the previous step that appears to work as intended, but when I attempt to plug it in to the boxes it keeps saying it’s incorrect. I’ve double-checked the syntax, so that doesn’t appear to be the problem. Has anyone else had problems with this?


#2

I am wondering if the issue is the “Range” function? I got the correct response, but I did not add a step digit (ie range(1,41,1)). Did you? Maybe that wasn’t considered as a correct response?


#3

I have the same problem. Wrote a code that gives me a lot of hip, hip hurray’s but when I put it in the boxes it comes out as incorrect. This course isn’t the best. It gives offers up a lot of problems where the solution will be covered in the next section. Breeds frustration for sure.


#4

I just checked out both of your submissions - make sure you read up on the range() function. In Python, range() creates a list of numbers based on the parameters provided. The first number will be what that list starts with, and the second number will be the first number not included in the list counting upwards. So, if you were to use range(3, 9), this would compile a list of numbers 3, 4, 5, 6, 7, 8.

Unfortunately, Stepik isn’t flexible enough for us to accept multiple solutions to the same problem, even if the behavior is the same, so be sure that you follow the directions as closely as possible. Sorry for any confusion!

I’ve just edited in the expected output for your code in 4.3 step 10, hopefully that will clear up any further questions.


Fill-in-the-Blank Questions
#5

My code worked fine but I had about 10 failed attempts on this one, changed everything else before I remembered I need some quotation marks to print strings. I’m probably the only one that made that mistake but thought I’d throw that out there.


#6

I forgot that one too, still working on the the answer Stepik wants (despite working code), but after my first submission I did facepalm the quote marks.


#7

After many failed attempts wondering what piece failed I realized my perception of the word “between” in the question was incorrect. In case anyone else is having the same issue:

I was thinking of “Between” as being defined WITHOUT endpoints included.
EX. Numbers “between” 1 and 5 would include 2, 3, and 4.

The definition being used in this question is using “Between” WITH endpoints included.
EX Numbers “Between” 1 and 5 would include 1, 2, 3, 4, 5.

Hope this helps!


#8

ive tried everything to get this correct added quotes and fiddled with the code to see if im doing something different but i cant figure out where the issue lies. is it perhaps capitalization?


#9

it was capitalization. you have no idea how upsetting these fill in the blanks are.


#10

Sadly, with coding, case-sensitivity can matter. I am struggling with Java lately, and that is one of the things I bump into a lot. An incorrect capitol letter, or lowercase-- a single messed-up symbol, and the thing won’t run. Ah, these must indeed be the joys of coding.


#11

I’m new, I’m stuck in this section. I wrote the code, I checked on repl.it that it works, and here I have a non-stop wrong answer. Can Adam look at my attempts?


#13

Hi all, I failed the test about 10 times. Then figured out this:
In the 4.3 10, I entered ‘for number in range(0,40)’ and got the expected outcome.
In the 4.3 11, I had to enter ‘for number in range(0,41)’ to pass.
Reason: 40 and 41 are neither % by 3 or % by 7.
The test in 4.3 11 simply wants (0,41), which is technically more correct, I think.


#14

Olgierd, check the conditional that you’re using to decide whether to print ‘Hooray’. If a number is divisible by both 3 and 7, we want the computer to print
Hip
Hooray,
not just one or the other.


#15

after many failed attempts wondering what I’m doing wrong


#17

not working in fill in the blank in step 11 but work on repl.it


#18

Hmm. Are you using division or the modulus function? The modulus (%) gives an output of zero if there is no remainder.


#21

My code works also. But filling in the blanks does not work. I have tried some of the suggestions. Any ideas?


#22

I’m having the same problem. I don’t know how to get it to print both Hip and or Hooray both if it meets either conditions. Everything worked fine on 4.3 step 10 but not 4.3 11.


#23

Are you indenting both quailifiers, for the 3 and the 7, so they fit in the same loop sequence?


#24

Looking at your submissions, you’ve gotten very close to it many times.

Remember that you want to print for numbers 1 - 40, and the range function is exclusive on the high end (meaning it does include the first number, but doesn’t include the second number). i.e., range(0, 3) would go through 0, 1, and 2, but not 3. If you wanted 1 through 3, you’d use (1, 4) as your arguments.

If you combine that with your use of the modulus, you should have the right answer.