Table of Contents

Overview

First pass at Python course topics.

Links:

… coming …

Packages

$ python3 -V
Python 3.7.4
$

Online tutorial

3

4

5 Data structures

TOPICS

STUFF

Basics

Arguments

import sys
print(sys.argv[0])

Printing

>>> print("hi")
>>> print("I am", age, "years old.")
>>> print(f"I am {age} years old.")     (format string)

>>> hilarious = False
>>> joke_evaluation = "Isn't that joke so funny?! {}"
>>> print(joke_evaluation.format(hilarious))
>>> print("Isn't that funny? {}".format(hilarious))

>>> print(end1 + end2 + end3 + end4 + end5 + end6, end=' ')
>>> print(end7 + end8 + end9 + end10 + end11 + end12)

>>> formatter = "{} {} {} {}"
>>> print(formatter.format(1, 2, 3, 4))
>>> print(formatter.format("one", "two", "three", "four"))

Strings

Raw strings: r“blah blah”

print("""\
Usage: thingy [OPTIONS]
     -h                        Display this usage message
     -H hostname               Hostname to connect to
""")