The Explorer’s Challenge: Naming New Species with Code

After months of adventure on the mysterious island of Xylogora, young explorer Mateo has finally returned home. His backpack is stuffed with notes, sketches, and a collection of breathtaking photos of creatures never seen before. From the feathered glimmerfox to the six-legged rippletoad, each animal was stranger and more exotic than the last.

But Mateo has a problem: Every great discovery needs a name, and he has dozens of new species waiting to be named and documented.

Pulling out his laptop, Mateo decides to create a naming algorithm using string-handling techniques. His plan is simple yet ingenious: take the names of existing animals, rearrange their letters, or combine parts of their names to create unique ones. For instance, the “Wolphin” might come from “Wolf” and “Dolphin”.

String Handling Techniques

To create his algorithm, Mateo will need to use the following string handling techniques:


  • LEFT: to extract characters at the beginning of a string,
  • RIGHT: to extract characters at the end of a string,
  • SUBSTR or MID: to extract a set number of characters at a given position in a string,
  • LENGTH: to find out the number of characters in a string,
  • String Concatenation: to join two or more strings together.

LEFTRIGHTSUBSTRString ConcatenationLENGTH
The LEFT() function is used to extract the first 5 characters of a string.

For instance:
LEFT(“WOLF”, 3) would return “WOL”.

The RIGHT() function is used to extract the last 5 characters of a string.

For instance:
RIGHT(“DOLPHIN”, 4) would return “PHIN”.

The SUBSTR() function is used to extract a set number of characters at a given position in a string. Note that in this case the first letter in a string is at position 0.

For instance:
SUBSTR(“PANDA”, 1, 3) would return “AND”.

String concatenation is a technique that uses the + operator to join two or more strings together.

For instance:
“WOL” + “PHIN” would return “WOLPHIN”.

The LENGTH() function is used to retrieve the number of characters in a string.

For instance:
LENGTH(“DOLPHIN”) would return 7.

Naming Unknown Species

Can you work out the name given to the following species?

Python Challenge

Can you help Mateo by writing a Python program that generates exotic animal names using string handling techniques? Your program will need to:

    Takes two (or more) animal names as inputs.
    Randomly combines parts of each name to create a new species name.
    Output the generated name.
    Let the user decide if they like the name or if the computer should have another go.

To do so you will need to complete the code provided below:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!