Random Alphabet Challenge

Welcome to the Random Alphabet Challenge! This set of three Python programming challenges is designed to test your problem-solving skills, creativity, and ability to manipulate strings and data structures.

But first let’s see if you can solve the following puzzle:

Hint?
Recite the alphabet in your head, one letter at a time and compare each letter with the letter of the randomised alphabet. If the two letters are the same, then you found the letter that is in the correct position!

Coding Challenge #1: Find the Correctly Placed Letter.

You are given a string of 26 uppercase letters, representing a shuffled version of the English alphabet. In this shuffled string, only one letter remains in its correct position (i.e., its position in the alphabet). Your task is to write a Python script that identifies which letter is correctly placed.

Example:

  • Input: “IVKOCEPJLTAMZNSYXUWRHFBDGQ”
  • Output: “N” (because “N” is the 14th letter of the alphabet and also the 14th letter in the given string)

Flowchart
Here is the flowchart to solve this challenge:

Python Code
Complete your code using the following online Python IDE:

Suggested Approach
Our recommended approach to solve this challenge is write a Python program to:

  • Iterate through each letter in the input string.
  • Compare the position of each letter in the string with its position in the alphabet.
  • Identify the letter where these positions match.

Testing
See if your code can find the letter in the correct position for the following shuffled alphabets:

Test # Input Values Output?
#1 SZDABJWLNRITXOUGQHEFPMVCKY
#2 OLMETJKXNGVYRZIWADSHPCQFBU
#3 XMBYCNGRQOVZPFWTJLHKEIUADS

Coding Challenge #2: Alphabet Shuffling Algorithm

In Stage 1, you wrote a Python script to identify the correctly placed letter in a shuffled alphabet string. Now, in Stage 2, we flip the script: your task is to generate a shuffled alphabet string where only one letter remains in its correct position.

You will need to write a Python program that:

  • Generates a random permutation of the 26 uppercase letters of the English alphabet.
  • Ensures that only one letter in this permutation is in its correct alphabetical position (e.g., “A” at index 0, “B” at index 1, etc.).

Coding Challenge #3: Quiz Time

This is the final stage of the Random Alphabet Challenge! In Stage 1, you identified the correctly placed letter in a shuffled alphabet. In Stage 2, you generated such a shuffled string. Now, in Stage 3, we combine both to create an interactive 10-round quiz where the player must identify the correctly placed letter in each round. Each correct answer scores one point.

Your Python script will need to:

  • Generate 10 shuffled alphabet strings (using your Stage 2 code), each with only one correctly placed letter.
  • Present each shuffled string to the user and asks them to identify the correctly placed letter.
  • Award one point for each correct answer (you may need to use your code from stage 1 for the computer to identify the correct letter and use this to check if the player’s answer is correct)
  • Display the final score at the end.
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 3.2 / 5. Vote count: 112

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

As you found this challenge interesting...

Follow us on social media!