1

Below is the code i tried using python

 >>> import string
 >>> def main():
    print "hey"
    print
    key = input ("key?")
    message = raw_input("Enter the message: ")
    codedMessage = ""
    for ch in message:
    codedMessage = codedMessage + chr(ord(ch) + key)
    print "the coded is: ", codedMessage


    >>> main()
    hey
    key?-1
    Enter the message: hey how are you?
    the coded is: gdx gnv `qd xnt>

but when i tried this in sage math..... the input function does not work

2 Answers 2

1

Unfortunately, to the best of my knowledge, while input and raw_input work from Sage in console mode, neither work from the Sage notebook (which you don't specify, but I'm assuming is what you were using).

0

raw_input does work in Sage Math Cloud, though with some strangeness right now (see https://github.com/sagemathinc/smc/issues/358). It looks pretty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.