Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Seite - 39 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

Seite - 39 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Bild der Seite - 39 -

Bild der Seite - 39 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Text der Seite - 39 -

2AFewMoreSteps 2.1 UsingPythonInteractively 2.1.1 TheIPythonShell Pythoncanalsobeusedinteractively, inwhichcasewedonotfirstwriteaprogram, store it in a file and then execute it. Rather, we give statements and expressions directly to what is knownas a Python shell. Thismeans that we communicatewith the Python interpretervia a particular interface. Interactiveuse of Python is a great waytoquicklydemonstratedifferentaspectsofPythonandwewilluse it repeatedly for this purpose. It is also very useful for testing out things like function behavior, syntax issues, etc., beforefinalizingrelatedcode in aprogramyouarewriting. We recommend to use IPython as shell (because it is superior to alternative Pythonshells).WithSpyder,Ipython isavailableatstartup,appearinginthelower right pane (the console).An interactive session appearsas a succession of pairwise corresponding input (to Python) and output (from Python). The user writes input commands after the IPython prompt1 In [p]:, wherep = 1,2,.. ., and gets the responseback (if any)afterOut [p]:. Thus,p serves as a counter for each pair of input and output (when there is no output, this “pair” will consist of only input). Toexemplify,we maywrite: In [1]: 2+2 Out[1]: 4 In [2]: 2*3 Out[2]: 6 In [3]: 10/2 # note: gives float Out[3]: 5.0 In [4]: 2**3 Out[4]: 8 1 A prompt means a “ready sign”, i.e. the program allows you to enter a command, and different programs often have different looking prompts. ©The Author(s) 2020 S.Linge, H.P. Langtangen, Programming forComputations -Python, Texts in Computational Science and Engineering 15, https://doi.org/10.1007/978-3-030-16877-3_2 39
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python 3.6
Band
Second Edition
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2020
Sprache
englisch
Lizenz
CC BY 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
356
Schlagwörter
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Kategorie
Informatik
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python