View the step-by-step solution to:

Question

Hi, I'm currently stuck with my homework. I need to know how to write this program in Python as below:

Write

function repeatPhrase(phrase, n), which prints the given phrase n times, alternating between lowercase and uppercase. For example, repeat('The sky is blue', 5) would print:

the sky is blue

THE SKY IS BLUE

the sky is blue

THE SKY IS BLUE

the sky is blue

Please help me, thank you very much! 

Top Answer

View the full answer
Untitled15.png

1 def repeatPhrase(phrase, n) :
2 -
for x in range (n) :
if x%2==0:
4
print (phrase. lower ( ) )
else:
6
print (phrase . upper ( ) )
7
repeatPhrase("THE SKY IS BLUE", 6)
the sky is blue...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question