This question is from the subject Computer science Python. Help me and pls explain the steps.
Answers
Answer:
SCHOOLbbbbCOM
Explanation:
I am explaining it line by line, explanation is italic text, program code is bold text
define a function which takes a input, and stores input into variable named s
def fun(s):
define a variable k, which calculates and stores number of characters in s
k=len(s)
create variable named m and store empty string into it
m=" "
start a counter(i) which counts from zero to length(k) of input string(s)
for i in range(0,k):
check if character at position(i) of input(s) is upppercase
if(s[i].isupper()):
if it's so then change uppsercase character at position(i) to lowercase, and store result into empty variable(m)
m=m+s[i].lower()
otherwise if character at position(i) of input(s) is alphabet
elif s[i].isalpha():
if it's so then change that alphabet character at position(i) to uppercase, and store result into variable(m)
m=m+s[i].upper()
if none of the above conditions match, that means it's not ablphabet
else:
then it must be a number - replace that number with 'bb' and save it into variable(m)
m=m+'bb'
finally, print the content of variable m when counting is complete
print(m)
NOW CALL ABOVE DEFINED FUNCTION
fun('school2@com')
peww. it's long reply