Python
please debug each python block. Do not change the algorithm. You can add statements or you can modify existing python statements.
# 8) Duplicate characters that are NOT vowels. Output should be apppplle 20 points
strobj = 'apple'
def strformat(strobj):
tempstr=''
for i in strobj:
if(i in ['a','e','i','o','u']):
tempstr = tempstr + i*2
print(strformat(strobj))
strobj = 'apple'
#method to duplicate the non-vowel character
def strformat(strobj):
tempstr=''
for i in strobj:
#check if character is vowel
if(i in ['a','e','i','o','u']):
tempstr = tempstr + i
#if character is not vowel
else:
tempstr = tempstr + i*2
#return the new string
return tempstr
#method calling and display the result
print(strformat(strobj))
The screenshot of the above source code is given below:
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.