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 - 59 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

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

Bild der Seite - 59 -

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

Text der Seite - 59 -

3LoopsandBranching 3.1 TheforLoop Many computations are repetitive by nature and programming languages have certain loopstructures to dealwith this. Onesuch loopstructure is the for loop. 3.1.1 Example:Printingthe5TimesTable Assume the task is to print out the 5 times table. Before having learned about loop structures inprogramming,mostofuswouldfirst thinkofcoding this like: # Naively printing the 5 times table print(’{:d}*5 = {:d}’.format(1, 1*5)) print(’{:d}*5 = {:d}’.format(2, 2*5)) print(’{:d}*5 = {:d}’.format(3, 3*5)) print(’{:d}*5 = {:d}’.format(4, 4*5)) print(’{:d}*5 = {:d}’.format(5, 5*5)) print(’{:d}*5 = {:d}’.format(6, 6*5)) print(’{:d}*5 = {:d}’.format(7, 7*5)) print(’{:d}*5 = {:d}’.format(8, 8*5)) print(’{:d}*5 = {:d}’.format(9, 9*5)) print(’{:d}*5 = {:d}’.format(10, 10*5)) ©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_3 59
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