Nutrition Facts -Problem Set 2 (CS50's Introduction to Programming with Python)

preview_player
Показать описание
hello, everyone and welcome to another video, in this video, I will explain and solve problem set 2, Nutrition Facts.

if you haven't already submitted this problem, You have to try this on your own.
This video is to just give you a way to solve this problem, try solving it using a different approach, to get the most benefits out of this experience.

Don't forget to hit the like button and subscribe to the channel, and if you have any questions or want an explanation for a specific problem leave a comment down below.

Рекомендации по теме
Комментарии
Автор

seriusly ? i, ve been in a LOOP trying to solve the "ignore invalid inputs" and it was only not writting at all!! and i use things such as continue, break, etc....my word!! while True:
get_fruit = input("Type of fruit: ").lower()
if get_fruit not in fruits:
continue
else:
print(f"Calories: {fruits[get_fruit]}")
break been doing such things like this and always getting cs50´s not pass... :( nutrition.py ignores invalid input
timed out while waiting for program to exit :DDD thanks

fvilpaz
Автор

For those referring to this, you need to use + instead of, in the print statement. This will erase the extra blank space between Calories: and the output.

Alternatively, you can remove the blank space after Calories: in “Calories:”

sagekaleke
Автор

Hi Dear, do u have plan to start problem set 3

shoppingarena
Автор

Shouldn’t line 25 have item inside of the bracket instead of fruit?

mohammedammar
join shbcf.ru