please help!! my class project was to build codes that could encrypt and decrypt caesar cipher codes. I took it upon myself to make both codes, and my decrypter code just destroys the shell. I turned to the internet and my teacher for help, but I have yet to come up with an answer. this code was written in the python IDLE shell, not any online python program. if you have an explanation or an answer, it would be very greatly appreciated. Here is the code. This is in the python version 3.6.4 in the IDLE shell. create a new file to run the program. be careful though! if you let it run for too long, it will crash the program and you won’t be able to close it.
alphabet = 'abcdefghijklmnopqrstuvwxyz' ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' Tris = 1 encrypted = 0 newMessage = '' while Tris > 0: key = 1 print("Please input anything you want to be decrypted.") message = input('word(s):') while key < 26: for charachter in message: if charachter in alphabet: position = alphabet.find(charachter) newPosition = (position + 1)%26 newCharachter = alphabet[newPosition] newMessage += newCharachter elif charachter in ALPHABET: position = ALPHABET.find(charachter) newPosition = (position + 1)%26 newCharachter = ALPHABET[newPosition] newMessage += newCharachter else: newMessage += charachter message = newMessage if message > newMessage: break print(newMessage) print(key) key += 1 encrypted += 1 print("would you like to decrypt another thing? 1 for yes 2 for no.") inpup = input() inpup = int(inpup) no = 2 if inpup != no: print("Great!!") if inpup == no: print("oh well, cya later!!") break print('you decrypted', encrypted,'messages.')
please contact me if you figure out why it dosent work.