Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python Problem of function. and Can you please give me explaination: So just say

ID: 3598860 • Letter: P

Question

Python Problem of function. and Can you please give me explaination:

So just say you have this in the text:

---------------------------

I love Teemo

Teemo love me

I love Jinx

Jinx love me

------------------------

as we see that there is 4 line above, and I would like the program print only the odd number of the line if the user ask. so the out put only

-------------------

I love Teemo

I love Jinx

-------------------

Also I need to know how if i want the program only print every 6 character from the text and if the character is vocal it print in capital. for example from

------------------

I love Teemo

Teemo love me

I love Jinx

Jinx love me

---------------

it just print

EO mvxlE

--------------

Explanation / Answer

#this is our miltiline text

text = """I love Teemo

Teemo love me

I love Jinx

Jinx love me"""

#first we would split the given text on the basis of newline characters

#it would give us a list of lines

lines = text.split(" ")

#by iterating on the lines list, we would print out the lines which are at odd index

for i in range(len(lines)):

if (i+1) % 2 != 0:

print(lines[i])

# this function is for getting the elements at every 6th position

for i in range(len(text)):

if (i > 1):

if (i+1) % 6 == 0:

if text[i].lower() in ('a','e','i','o','u'):

print(text[i].upper(),end='')

else:

print(text[i],end='')

output:

Second function is output is different from yours because we are also including newline chracter in our count.