Periodic Table Database - Problem With One Test

Hello, I have one problem with periodic table project.

I don’t have any idea how to pass this test.

I tried else statement in while loop but I got multiple sentence “I could not find that element in the database”. I don’t know how to check this condition only on the last iteration.
I also thought about piping output from while loop to variable and then check it’s empty or no but I don’t know how to do it properly.

Here is my github: GitHub - aknieszka/periodic_table

And link to the project:

Thank you in advance for your help.

why don’t you just create a select statement. If the select statement cannot find the element then you can print out the message?

Thanks for your reply.
I found another solution. I move my stdout to .txt file and check if this file is empty or not and then I print proper message.