I found a small bug

In the Intro to strings when I wasn’t getting the correct response for the exercise, the syntax error help thing was giving the wrong info about the exercise.

https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-strings/lessons/introduction-to-strings/exercises/more-string-slicing

I finished the exercise. I just wanted to let someone know that there was a small bug in that program.

The error message is correct.

Take a look at line 5 of your code.

first_name[:-3] should be changed to first_name[-3:] if you want “lie” instead of “Ju” as a result.

The SCT for the lesson runs your code using additional ‘test cases’. That’s why you see the name, “Julie Blevins” instead of “Reiko Matsuki” in the error message.

1 Like

Thanks @midlindner. I didn’t know it would test other cases.

2 Likes

If all we had to do is produce the correct output for the single case, we could effectively cheat by doing something like this:

first_name = "Reiko"
last_name = "Matsuki"

def password_generator(first_name, last_name):
  return 'ikouki'

temp_password = password_generator(first_name, last_name)
print(temp_password)

The additional test cases force us to write code that will work with various inputs.

2 Likes