Challenge: Find the Previous Alphabet

Test your understanding of the concepts we have covered so far by solving a simple challenge.

We'll cover the following

Problem statement

In this challenge, you are given a character that is stored in a variable named character. Your task is to write a code that makes the same variable, character, now store the character preceding the one originally stored in it. For example, if the variable stored C originally, your code should make it store B.

Input

We have already initialized the variable character at the backend.

character = 'B'

Output

The value stored in the variable character_before should be the previous character.

character_before = 'A'

📝 Please use the variables character and character_before for input and output, respectively, or your code will not execute.

Coding exercise

Before diving directly into the solution, try to solve it yourself. Then, check if your code passes all the test cases. If you get stuck, you can always see the given solution.

Good luck! 👍

Get hands-on with 1400+ tech skills courses.