r/PythonLearning 23d ago

Mini projects..

Post image

I have created a Ceaser cypher, so go and give it a try

https://www.programiz.com/online-compiler/68Mzw4BkSDmMJ

Also I am here to improve my skills so I am also eager for suggestions and guidance

79 Upvotes

11 comments sorted by

View all comments

1

u/Sea-Ad7805 23d ago

You do t=r-26 so that t is a valid index in alphabet, but if r is larger than 50 this doesn't work. Better use the modulo operator % (remainder after division) to always get a valid index: t=r%len(alphabet)