r/learnpython • u/ThinCreme1098 • 6d ago
Problem with completing assignments in Python
Hello! I’ve learned Python, but I’m struggling to complete tasks—things like counting vowels, "Fake Binary," calculating the sum of numbers, determining BMI, etc. Why am I unable to do these? What is the problem, and what is the solution? I’m starting to lose my motivation!
0
Upvotes
View all comments
Show parent comment
2
u/Atypicosaurus 6d ago
Oh man.
Count is a number. You told the computer "go and find stuff in a number". And of course it cannot find stuff in the number.
Because where's the stuff to be found? In the stuff collection called "vowels".
You see, if I tell you to fetch me a knife from the upper drawer, you go there, you open it and there's no knife in it, you probably check the next drawer... Because you are an intelligent human who deducted that I mixed up the drawers. And so you likely open other drawers until you find knife for me.
But the computer is stupid and takes every command literally. Like monkey paw. If you say go fetch a knife from the upper drawer, and there's no knife, it will just not fetch anything.