PYTHON 2713 Each function must be aswered RECURSIVELY NO LOO
PYTHON 2.7.13
Each function must be aswered RECURSIVELY, NO LOOPS ALLOWED
1. Write a function called acronym. This function is passed a string s, and returns a string consisting of all of the capitalized letters in s. For example:
def acronym(s):
>>> acronym(\'United States of America\')
\'USA\'
>>> acronym(\'Depaul University\')
\'DPU\'
>>> acronym(\'the University of Illinois at Chicago\')
\'UIC\'
Solution
def acronym(s):
ans = \"\"
for a in s:
kk = ord(a)
if kk>=65 and kk<=90:
ans = ans + a
return ans
print(acronym(\"United States of America\"))
