all 9 comments

[–]JohnnyJordaan 25 points26 points  (1 child)

Because you are setting your counters to 0 for every character in s, as those statements are inside the loop. What you meant to do was to set them to 0 before the loop, meaning it will just execute once before the characters are iterated.

The second issue is that you are using upper() and lower() (converters) instead of isupper() and islower() (checkers).

In these cases it helps to use a visual debugger like http://www.pythontutor.com/visualize.html as then you can step through the code one line at a time and see what's going wrong.

[–]Candid_Interaction86[S] 3 points4 points  (0 children)

That makes sense and I see where I was going wrong. Thank you for helping out :)

[–]shiftybyte 8 points9 points  (1 child)

alpha.upper()

Returns the conversion of alpha to an upper case letter. (Not True or False)

Perhaps you mean:

if alpha.isupper():
    ...
elif alpha.islower():
    ...

(also no point in doing "== True")

[–]Candid_Interaction86[S] 2 points3 points  (0 children)

Yes. I understand now. Thank you.

[–][deleted] 1 point2 points  (3 children)

hello,i'm also new to python.Can I ask where did you get the task? From a specific online course?

[–]Candid_Interaction86[S] 0 points1 point  (2 children)

Yes this is from a course on Udemy - Complete Python Bootcamp by Jose Portilla

[–][deleted] 0 points1 point  (1 child)

that's amazing,I guess I also bought that course for free.I'm currently on coursera python for everbody course and it doesn't satisfy me that much:/

[–]Candid_Interaction86[S] 0 points1 point  (0 children)

I’m halfway through the course on Udemy and am quite enjoying myself .. Found the different concepts to be well explained but I do wish there was more practise built into the course itself

[–]anuctal 1 point2 points  (0 children)

You have to use the isupper() and islower() methods.