Introduction to Flask - Adopt a pet

Hello dear people,

fellow learner from germany here,

I have a problem on task 16 on the project “Adopt a pet”. The links of the names of the pets just show the 404 error but I can’t figure out why.

Thanks for any kind of help ! :slight_smile: My code below:

and a link to the exercise:

On line 22 you’re inputting the href link using the variables. However currently there’s no way for the code to actually know there’s variables in there, instead just the string <pet_type> is part of the link. You need to use either format() or f to tell the code that there are variables inside, both examples are below:

 html += f'<li><a href = "/animals/{pet_type}/{index}">' + pet['name'] + '</a></li>'
# Note that the variables are in curly brackets to denote that these are to be filled by the 'f' function.

and the .format() method:

html += '<li><a href = "/animals/{pet_type}/{index}">'.format(pet_type = pet_type, index = index) + pet['name'] + '</a></li>'

Thans alot now its working :slight_smile: