-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstep_4.html
46 lines (46 loc) · 1.3 KB
/
step_4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes"
/>
<title>step_4</title>
<style type="text/css">
code {
white-space: pre-wrap;
}
span.smallcaps {
font-variant: small-caps;
}
span.underline {
text-decoration: underline;
}
div.column {
display: inline-block;
vertical-align: top;
width: 50%;
}
</style>
</head>
<body>
<h2 id="step-4-use-the-built-in-library-datetime">
Step 4: Use the built-in library datetime
</h2>
<p>
Use the built-in library datetime and the function
<code>datetime.datetime.now()</code> to determine the current year and
print that to REPL using an f-string.
</p>
<pre><code>>>> import datetime
>>> right_now = datetime.datetime.now()
>>> # What is this thing?
>>> right_now
datetime.datetime(2020, 7, 10, 14, 41, 33, 790353)
>>> print(f"What a crazy year {right_now.year} has been, eh?")
What a crazy year 2020 has been, eh?
>>></code></pre>
</body>
</html>