Write the output of the following program:

Str = "Computer Science"

index = 0

while index < len(Str):

  if Str[index] in "aeiouAEIOU":

    print(Str[index].upper(), end=" ")

  elif index % 2 == 0:

    print(Str[index].lower(), end=" ")

  else:

    print(Str[index], end="")

    print("#", end=" ")

  index += 1

Answer:

Answer by student

The output of the program is:

 

c O m p# U t# E r#   S# c I E n# c E

Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.