ThePlacid 0 Newbie Poster

Hello, i need help with my project.
Im making a program that encrypts and decrypts the contents of a text file.
I had to generate an 8 character key which is converted to ascii and then calculate the offset factor of the key that was generated (New every time program is run) next i converted the contents of the user specified text file to ascii characters and added them to the offset factor calculated earlier, I need some help with this part though, it prints the (so far) the encrypted text and then adds it to offset factor, but the if the result is above 126 i have to minus 96. How would i do this

add_offset_to_text=[s + offset_factor for s in ascii_text] 

That is the part where it gets added so far, if you would like to see the whole code so far, private message me.

Thanks so far.