My code takes a line of text from the user and attempts to encode or decode the text using a function I have created. However I am trying to print all the results of one line and also include the spaces that the user inputted so that it clearly shows that each word has been encoded. It currently just prints all the results underneath one another and does not include the spaces that the user inputted.
print ""
# To God be the Glory
text = raw_input("Please enter a line of text: ")
text = text.lower()
print ""
key = int(input("Please enter a key: "))
def ascii_func (text) :
for charc in text:
if charc in ['-', '+', '*', '/', '!' , "@"]:
print "Error input is not correct"
for charc in text:
if charc != " " :
charc = ord(charc)
charc = (charc - 97) + key
charc = (charc % 26)
charc = charc + 97
charc = chr(charc)
print charc
ascii_func(text)