FAQ: Code Challenge: String Methods - Make Spoonerism

This community-built FAQ covers the “Make Spoonerism” exercise from the lesson “Code Challenge: String Methods”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Python 3

FAQs on the exercise Make Spoonerism

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

15 posts were split to a new topic: Sharing Solutions


Could someone tell me, for the code below:

def make_spoonerism(word1,word2):
return B+C, A+D

print(make_spoonerism(“Codecademy”, “Learn”))

(“Lodecademy”, “Cearn”)

How to I tweak the code so the output reads:
Lodecademy Cearn
(ie. without the brackets and quotation marks)

If you have two strings, how can you combine them into one?
Actually you have three strings, you need a space as well.
Try + … you already used that, even.

1 Like

Ahhh - thankyou - appreciated.

Only problem with that swap is that it will make the first letter of both words the same.

1 Like

what am I missing ?

A swap takes three steps.

# given A and B

A = 6
B = 7

To swap the two values we need to hold one of them temporarily.

C = A
A = B
B = C

The logic is simple. Once A becomes B, how can B become A?

    print (A)    #  7
    print (B)    #  6
1 Like

I get it now
Thank you Sir

1 Like