-
Notifications
You must be signed in to change notification settings - Fork 3
/
step_3.html
45 lines (45 loc) · 1.29 KB
/
step_3.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
<!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_3</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-3-ask-a-user-for-their-name-and-age.">
Step 3: Ask a user for their name and age.
</h2>
<p>
Write code to tell them how many years you are older than them (negative
numbers for younger is fine at this point instead of older / younger with
only positive numbers).
</p>
<pre><code>>>> my_age = 47
>>> response = input("How old are you? ")
How old are you? 53
>>> their_age = int(response)
>>> diff = their_age - my_age
>>> print(f'Great age! You are {diff} years older than me.')
Great age! You are 6 years older than me.</code></pre>
</body>
</html>