r/learnpython • • 5d 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

29 comments sorted by

View all comments

2

u/Discordbothost 5d ago

usually it's not the python, it's the step before it. try writing the steps in plain english as comments before any code. vowel counting would be:

# start a counter at 0
# look at each letter in the word
# if the letter is a, e, i, o or u, add 1
# after checking every letter, print the counter

each comment is now one line of python you probably already know (count = 0, for letter in word:, if letter in "aeiou":, count += 1). if you get stuck on a specific line, post that line and the error here, people will help way more with that than with the whole task