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

13

u/lfdfq 11d ago

I'm not sure how you expect us to be able to answer why specifically you struggle with these specific tasks, when you have told us nothing about you and what you've done and learned so far, or what you tried, or where you got stuck, or in what way you otherwise struggle.

2

u/ThinCreme1098 11d ago

For example, I’m trying to create a project that counts vowels, but it’s not working—the result isn’t what it should be. Here is my code; I don’t know what’s missing or why I’m having this problem. Could you take a look at my code?

vowels = ["a" , "e" , "i" , "o" , "u"]
count = 0
for vowels in count:
    if vowels == ["a"]:
        count += 1
    elif vowels == ["e"]:
        count += 1
    elif vowels == ["i"]:
        count += 1
    elif vowels == ["o"]:
        count += 1
    elif vowels == ["u"]:
        print(vowels)

1

u/Refwah 11d ago

For vowel in vowels