41.3k views
5 votes
(Find the number of uppercase letters in a string) Write a recursive function to return the number of uppercase letters in a string using the following function headers: def countUppercase(s): def countUppercaseHelper(s, high): Write a test program that prompts the user to enter a string and displays the number of uppercase letters in the string.

User Donkey
by
3.4k points

1 Answer

4 votes
def countUppercase(s):
count=0
for i in s:
if i.isupper():
count+=1
s=s.replace(i, "")
else:
s=s.replace(i, "")
countUppercase(s)
return count

element=input("Enter the string: ")
string=countUppercase(element)
print("\\Number of upper letter in the string: ",string)
(Find the number of uppercase letters in a string) Write a recursive function to return-example-1
User Liki Crus
by
3.1k points