End of Summer - hours only!Up to 80% off on all courses and bundles.-Close
Cipher
5. Implementing the cipher – step 2

Instruction

Great! Of course, you can also shift the lowercase letters.

Exercise

In the template you can see a solution from the previous exercise. Change the function so that it preserves the case of the letters. The uppercase letters stay uppercase and lowercase letters stay lowercase.

E.g., for word = 'LearnPython' and shift = 3, the function should return 'OhduqSbwkrq'.

Stuck? Here's a hint!

You have to come up with a different expression for lowercase letters. To check if a letter is lowercase, you can use letter.islower(); to check if it's uppercase, you can use letter.isupper(). For lowercase letters the cycle starts with 'a', not 'A'.

Lowercase letters