Ask Your Question

How to create a "sage program" with command line input

asked 2018-12-18 23:35:35 +0200

Riccardo gravatar image

I am completely new to Sage and Pyhton, so this is probably a very trivial question, but I am not able to find any answer. I have a file script.sage


I use this script via sage script.sage and it does what I want. How can I modify this so that I can pass the variable N in the command line? Something like sage script.sage 10 and then it prints the result.

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-19 22:46:32 +0200

updated 2018-12-19 22:47:50 +0200

You can start here: and Briefly: N = sys.argv[1] should work.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-12-18 23:35:35 +0200

Seen: 444 times

Last updated: Dec 18 '18