Loshan Wickramasekara
Loshan Wickramasekara

Reputation: 109

input text in python using sage math

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

Upvotes: 1

Views: 1828

Answers (2)

kcrisman
kcrisman

Reputation: 4402

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.

Upvotes: 0

DSM
DSM

Reputation: 353449

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).

Upvotes: 1

Related Questions