Learn-lambda-functions-by-building-an-expense-tracker - Step 41

I think I have the right code for step 41 but it doesn’t pass.

elif choice == ‘5’:
print(‘Exiting the program.’)

Welcome to the forum @yorkzhong

image

Trying removing the back slash and see what happens

Also, in future please post code between three backticks (`), each on a separate line, instead of screen shots.

Happy coding

Thanks, still not working. here’s my code:

elif choice == ‘4’:
    category = input(‘Enter category to filter: ‘)
    print(f’\nExpenses for {category}:’)
    expenses_from_category = filter_expenses_by_category(expenses, category)
    print_expenses(expenses_from_category)

elif == ‘5’:
    print(‘Exiting the program.’)

thanks for the help!

Hi York, in the second elif statement you are missing the choice variable, however you do have it in your original screenshot. Looks like the help prompt is wrong, which is not helpful.

thanks, how dumb I was.

Smarter today than you were yesterday. Going in the right direction.

3 Likes

hello york, did your code pass.

I keep getting the same error message

You have the same error! I think you forget choice variable in the second elif!

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Looks like there is a typo in the hint, I’ve submitted a pull request for this

https://github.com/freeCodeCamp/freeCodeCamp/pull/52838

I am getting the same error message. The prompt says ‘’’ You should have elif == '5': in your code.‘’’ I tried that it gave me an error. I believe the right code should be ‘’’ You should have elif choice == ‘5’: in your code. Please help. I am confused.

hey @zack3 , please open your own topic to ask for help

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

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