Bug in "15. Practice Makes Perfect"


#1



I dunno what I'd did but it's pass through assertions.


str = "Print hack bed"
print list(list.index('hack'))


#2

They're asking you to define a censor(text, word) function :confused:


#3

@root4af is correct. You need to create a censor function.

However, it is also interesting that your code passed, when it should have been rejected. You found a bug in Codecademy's submission correctness test (SCT) for this exercise.

This statement led to a crash of the SCT ...

str = "Print hack bed"

#4

Well, look at that.~


#5

Yeah, thanks, I'm already passed it.


#6

The SCTs for the Python exercises are written in Python.

Here, we have a list of the built-in functions for Python 2: 2. Built-in Functions.

One of those functions is class str(object='').

When the SCT tried to use this function, it was not longer operative, because this statement replaced the function with a string ...

str = "Print hack bed"

(edited)
There are three issues to acknowledge from this observation.

  • Thanks for your input, @root4af.
  • @ya_sam, it is cool that you found this bug.
  • It is best not to use the name of a built-in function as the name of a variable.

#7

i thought ya_sam found the bug?


#8

Totally not me though! lol


#9

Oops, try again! (said to myself).


#10

yes, you passed it. But you didn't really program. If you are satisfied with this, you can move on, or you can actually build a program which will censor words in a string (if you didn't already)


#11

Yes, @ya_sam , you should follow @stetim94 's suggestion. Then you can get twice as much benefit from this exercise as other users do.

You will have learned ...

  • How to crash the SCT.
  • How to write the censor function.

:wink:


#12

I'd already did it. This post was just for bug report.


#13

@ya_sam, thanks for the bug report; this bug might not get fixed, however, because Codecademy is currently developing an entirely new Python track.

See Important Changes to Codecademy Courses.


#14

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.