Computer Science, asked by devanshrastogi35, 7 months ago

Find and write the output of the following Python code (5)

def Display(str):

m=""

for i in range(0,len(str)):

ifstr[i].isupper():

m=m+str[i].lower()

elif str[i].islower():

m=m+str[i].upper()

else:

if i%2==0:

m=m+ str [i-1]

else:

m=m+"#"

print(m)

Display('[email protected]')​

Answers

Answered by ankit19799
0

Answer:

fUN#pYTHON##.

Explanation:

Plz mark me as brainliest

Answered by surajnegi0600
0

Answer:

The output of the code is: "fUn#pYtHoN#.0".

Explanation:

The code defines a function called "Display" which takes a string input. It initializes an empty string called "m". The function then iterates over each character in the input string using a for a loop.

If a character is uppercase, it converts it to lowercase and adds it to the "m" string. If a character is a lowercase, it converts it to uppercase and adds it to the "m" string.

If a character is not an alphabetic character, the code checks if the current index of the character in the input string is even or odd. If the index is even, the character before the current one is added to "m", else a "#" is added to "m". After the for loop, the "m" string is printed as the final output.

More questions and answers

https://brainly.in/question/27627009?referrer=searchResults

https://brainly.in/question/12929883?referrer=searchResults

#SPJ3

Similar questions