Day 5: decoding

Hi there! I’m a passionate learner who loves exploring Python's endless possibilities. Over the past years, I’ve immersed myself in coding, honing my skills by tackling diverse projects that combine creativity and problem-solving.
From building a modern rendition of the classic Asteroids game in Python to experimenting with data visualization and automation, I thrive on turning ideas into reality through code.
Follow along as I learn, grow, and share my journey!
Today, I did the opposite of yesterday's encoding and decoded the cipher given the coded message and the shift value.

def decrypt(text, shift):
new_text = []
for letter in text:
index = alphabet.index(letter)
new_position = (index - shift) % len(alphabet)
new_text.append(alphabet[new_position])
print(''.join(new_text))
The key was to make sure that if the value is low like 'b' and you're shifting that you loop around to the end by using the modulus operator.
Follow me on Twitter at AllieNicole903




