Q2.Find the output of the following
Text=”gmail@com”
L=len(Text)
ntext=” “
For i in range (0,L):
If text[i].isupper():
ntext=ntext+text[i].lower()
elif text[i].isalpha():
ntext=ntext+text[i].upper()
else:
ntext=ntext+’bb’
Answers
Answered by
16
Answer:
ntext= GMAILbbCOM
Explanation:
the first line checks if the character at ith position is in upper case
in this case no
then it checks if the character is alphabet
in this case yes
so it is converted to capital
when it reaches @ sign it satisfies the last condition and
@ is replaced by bb
at
i=0 the value stored is g
i=1 the value stored is m
. a
. i
.
.
.
i=8 the vale storedis m
Similar questions