You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Counter(name.title() for name in ('Ann', 'Bob', 'Bob', 'Michael', 'michael')) = Counter({'Bob': 2, 'Michael': 2, 'Ann': 1})
47
+
48
+
### Computing checksums
49
+
50
+
And the functions `md5` and `sha1` returns the correspondingly hex-digest of the stringified version of the inputs, e.g. `md5(['foo', 'bar', 'baz']) = dbb432a3f0ac1a2687911715dfbf7502`. Notice that it's possible to hash the list _because it's the string-representation of the list which are being hashed!_
51
+
52
+
The python `hashlib.md5` and `hashlib.sha1` functions are avaiable under the names `_md5` and `_sha1`.
53
+
54
+
### Inserting datatimes
55
+
56
+
The functions `dnow`, `tnow` and `dtnow` return respectively the current string-formatted date, time and datetime:
57
+
58
+
dnow() = 03/05/2017
59
+
tnow() = 09:36:03
60
+
dtnow() = 03/05/2017 09:36:03
61
+
62
+
Notice that you need to have parenthesis after the function name to invoke the function call.
63
+
64
+
### Formatting numbers
65
+
66
+
The fnuction `formatnum` formats numbers, and takes two mandatory and an optional argument:
67
+
68
+
num
69
+
: The number bieng formatted.
70
+
71
+
digits
72
+
: The number of desired digits in the formatted number.
73
+
74
+
scientificNotation
75
+
: Wether of not to use scientific notation.
76
+
: Can be True, False or int, where int is the threshold for how many characters the number may contain when formatted un-scientifically, before switching to scientific notation.
77
+
: This is the default behaviour, and it's set to 8.
0 commit comments