Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 1.92 KB

not_included.md

File metadata and controls

80 lines (57 loc) · 1.92 KB

Comments

In Python, single lines can be commented by the hash symbol (#):

# this is a comment.
print(a + b)  # adding the variables

Also, multi-line comments can be enclosed by triple quotes:

'''
This is a longer description
that stretches over multiple lines.
'''

Hint

The triple quoted comments can be used to generate documentation automatically.

Exercise 8.2

Which lines are commented?

  • """This is a comment"""
  • # This is a comment
  • // This is a comment
  • <!-- This is a comment !-->
  • '''This is a comment'''

Length of strings

Is returned as an integer by the len() function.

s = 'Manipulating Strings '
print(len(s)

len() dict if Kommentare escape characters Formatstrings math open() TRANSFER: Matrix mutable/immutable, simple/composed sum() sorted() import pip Bücher und Webseiten Eingabe-Verarbeitung-Ausgabe Copy-Paste-Programmierung Vom Skript zur Software Fehlerbehebung

Aufgabe:

  1. Datei mit Babynamen laden
  2. ersten Buchstaben ausgeben
  3. Gesamte Geburten für 1 Buchstaben
  4. Gesamte Geburten für alle Buchstaben einzelnt
  5. Ausgabe als Tabelle auf dem Bildschirm
  6. Alle Jahrgänge laden
  7. Tabelle Excel exportieren
  8. Timeline plotten

Creating plots The Matplotlib library contains a wide range of possibilities for creating graphs. See the 'gallery' link on http://matplotlib.sourceforge.net for examples. It needs to be installed separately. from pylab import * Number crunching Numpy is a library that allows operating on arrays and matrices. It needs to be installed separately. See: http://numpy.scipy.org import numpya = numpy.array( [1,2,3,4,5,6] )print a+10, a*a Image manipulation The Python Imaging Library PIL is a powerful tool for working with images (changing formats, resizing, cutting, drawing). It needs to be installed separately. See http://www.pythonware.com/products/pil .