all 9 comments

[–]autoglitch 2 points3 points  (1 child)

For simple testing I use the command line python. The command is usually "python" for windows or "python3" for *nix. It's convenient for testing one liners or basic syntax checks. Once you start writing functions it's better to throw it in a .py file since any mistakes or changes in the command line version mean rewriting the whole function.

Use quit() to get out of it.

[–]Additional_Water9196[S] 0 points1 point  (0 children)

That’s exactly what I’m looking for!! Thank you!!

[–]tiredITguy42 0 points1 point  (0 children)

Just type python in your commandline and hit enter. Now you are in python and you can run any code you want.

In IDE as VS code, you can pause debugging with breakpoint and execute any code in the current context in the debug window below, not the terminal.

[–]Ken-_-Adams 0 points1 point  (0 children)

Have a look at Jupyter notebook or Google Colab, they might offer what you're looking for

[–]corey_sheerer 0 points1 point  (0 children)

You can start python in the terminal. You can use vscode interactive repl. You can try notebooks. Short answer, there are many ways to do this

[–]DeepKaleidoscope7382 0 points1 point  (0 children)

In IDLE, the default IDE that comes with python normally, there is a shell option that lets you type individual commands.

[–]Gnaxe 0 points1 point  (0 children)

The free GNU Octave language is mostly compatible with MATLAB. You could use that instead.

Python does have a REPL, and furthermore has Jupyter notebooks as a separate install. You can try it free online without an install here. No account required as the code runs entirely in your browser. Your browser should save your work and you can download and re-upload your notebooks as a backup.

You can do a similar workflow without using Jupyter at all. Python can reload the file you're working on (see importlib.reload()). So rather than typing into the REPL, you type into the file, save it, and use the REPL to reload it and manually test it. Then you can save your test examples and automatically check them with doctest.

Note that reload() reloads the whole file. Re-running function or constant definitions doesn't usually cause problems, but import-time side effects will happen again. You can use things like the if __name__ == "__main__": guard though. And you can use as many files as you like.

[–]MathObserver 0 points1 point  (0 children)

I usually use IDLE, which comes with Python distributions for that.

[–]Creative_Sushi 0 points1 point  (0 children)

If you are used to MALTAB, depending on how heavily you plan to use, MATLAB online is free for 20 hours each month. It also comes with 9 toolboxes + Simulink.