Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Page - 315 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 315 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 315 -

Image of the Page - 315 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 315 -

A.4 HowtoWriteandRunaPythonProgram 315 A.4.2 TextEditors The most widely used editors for writing programsare Emacs and Vim, which are availableonall majorplatforms.Somesimpleralternatives forbeginnersare • Linux:Gedit • MacOS X: TextWrangler • Windows:Notepad++ We may mention that Python comes with an editor called Idle, which can be used to write programs on all three platforms, but running the program with command- line arguments is a bit complicated for beginners in Idle so Idle is not my favorite recommendation. Gedit is a standard program on Linux platforms, but all other editors must be installed in your system. This is easy: just google the name, download the file, and follow the standard procedure for installation. All of the mentioned editors come with a graphical user interface that is intuitive to use, but the major popularity of EmacsandVim isdue to their richset of short-keysso thatyoucanavoidusing the mouseandconsequentlyedit at higherspeed. A.4.3 TerminalWindows To run the Python program, you may use a terminal window. This is a window where you can issue Unix commands in Linux and Mac OS X systems and DOS commandsinWindows.OnaLinuxcomputer,gnome-terminalismyfavorite,but otherchoicesworkequallywell, suchasxtermandkonsole.OnaMaccomputer, launch theapplicationUtilities—Terminal.OnWindows, launchPowerShell. You must first move to the right folder using the cd foldername command. Then runninga pythonprogramprog.py is a matter of writingpython prog.py. Whatever theprogramprintscanbeseen in the terminalwindow. A.4.4 UsingaPlainTextEditorandaTerminalWindow 1. Create a folder where your Python programs can be located, say with name mytestunderyour homefolder. This is most convenientlydone in the terminal window since you need to use this window anyway to run the program. The commandforcreatinganewfolder ismkdir mytest. 2. Move to thenewfolder:cd mytest. 3. Start the editorofyourchoice. 4. Write a program in the editor, e.g., just the line print(’Hello!’). Save the programunder thenamemyprog1.py in themytest folder. 5. Move to the terminal window and writepython myprog1.py.You should see thewordHello!beingprinted in the window.
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python 3.6
Volume
Second Edition
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2020
Language
English
License
CC BY 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
356
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python