Skip to content

Commit 615c450

Browse files
committed
Fix: typo
1 parent ff2d419 commit 615c450

1 file changed

Lines changed: 35 additions & 22 deletions

File tree

pretext/SimplePythonData/Input.ptx

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
do is allow the user to enter any value they wish for the number of seconds. The program could then print the
77
proper result for that starting value.</p>
88
<p>In order to do this, we need a way to get <term>input</term> from the user. Luckily, in Python
9-
there is a built-in function to accomplish this task. As you might expect, it is called <c>input</c>.</p>
9+
there is a built-in function to accomplish this task. As you might expect, it is called <c>input</c>.
10+
</p>
1011
<program language="python">
1112
<input>
1213
n = input("Please enter your name: ")
13-
</input>
14+
</input>
1415
</program>
1516
<p>The input function allows the user to provide a <term>prompt string</term>. When the function is evaluated, the prompt is
1617
shown.
@@ -22,10 +23,10 @@ n = input("Please enter your name: ")
2223
<input>
2324
n = input("Please enter your name: ")
2425
print("Hello", n)
25-
</input>
26+
</input>
2627
</program>
2728
<p>It is very important to note that the <c>input</c> function returns a string value. Even if you asked the user to enter their age, you would get back a string like
28-
<c>"17"</c>. It would be your job, as the programmer, to convert that string into
29+
<c>"17"</c>. It would be your job, as the programmer, to convert that string into
2930
an int or a float, using the <c>int</c> or <c>float</c> converter functions we saw
3031
earlier.</p>
3132
<p>To modify our previous program, we will add an input statement to allow the user to enter the number of seconds. Then
@@ -42,7 +43,7 @@ minutes = secs_still_remaining // 60
4243
secs_finally_remaining = secs_still_remaining % 60
4344

4445
print("Hrs=", hours, "mins=", minutes, "secs=", secs_finally_remaining)
45-
</input>
46+
</input>
4647
</program>
4748
<p>The variable <c>str_seconds</c> will refer to the string that is entered by the user. As we said above, even though this string may be <c>7684</c>, it is still a string and not a number. To convert it to an integer, we use the <c>int</c> function.
4849
The result is referred to by <c>total_secs</c>. Now, each time you run the program, you can enter a new value for the number of seconds to be converted.</p>
@@ -57,7 +58,7 @@ print("Hrs=", hours, "mins=", minutes, "secs=", secs_finally_remaining)
5758
n = input("Please enter your age: ")
5859
# user types in 18
5960
print ( type(n) )
60-
</input>
61+
</input>
6162
</program>
6263
</statement>
6364
<choices>
@@ -67,31 +68,31 @@ print ( type(n) )
6768
</statement>
6869
<feedback>
6970
All input from users is read in as a string.
70-
</feedback>
71+
</feedback>
7172
</choice>
7273
<choice>
7374
<statement>
7475
<p>&lt;class 'int'&gt;</p>
7576
</statement>
7677
<feedback>
7778
Even though the user typed in an integer, it does not come into the program as an integer.
78-
</feedback>
79+
</feedback>
7980
</choice>
8081
<choice>
8182
<statement>
8283
<p>&lt;class 18&gt;</p>
8384
</statement>
8485
<feedback>
8586
18 is the value of what the user typed, not the type of the data.
86-
</feedback>
87+
</feedback>
8788
</choice>
8889
<choice>
8990
<statement>
9091
<p>18</p>
9192
</statement>
9293
<feedback>
9394
18 is the value of what the user typed, not the type of the data.
94-
</feedback>
95+
</feedback>
9596
</choice>
9697
</choices>
9798
</exercise>
@@ -101,12 +102,18 @@ print ( type(n) )
101102
<p>Click on all of the variables of type `int` in the code below</p>
102103
</statement>
103104
<areas>
104-
<cline><area correct="no">seconds</area> = input("Please enter the number of seconds you wish to convert")</cline>
105-
<p></p>
106-
<cline><area>hours</area> = int(<area correct="no">seconds</area>) // 3600</cline>
107-
<cline><area>total_secs</area> = int(<area correct="no">seconds</area>)</cline>
108-
<cline><area>secs_still_remaining</area> = <area>total_secs</area> % 3600</cline>
109-
<cline>print(<area>secs_still_remaining</area>)</cline>
105+
<cline>
106+
<area correct="no">seconds</area> = input("Please enter the number of seconds you wish to convert")</cline>
107+
<p></p>
108+
<cline>
109+
<area>hours</area> = int(<area correct="no">seconds</area>) // 3600</cline>
110+
<cline>
111+
<area>total_secs</area> = int(<area correct="no">seconds</area>)
112+
</cline>
113+
<cline>
114+
<area>secs_still_remaining</area> = <area>total_secs</area> % 3600</cline>
115+
<cline>print(<area>secs_still_remaining</area>)
116+
</cline>
110117

111118

112119
</areas>
@@ -117,12 +124,18 @@ print ( type(n) )
117124
<p>Click on all of the variables of type `str` in the code below</p>
118125
</statement>
119126
<areas>
120-
<cline><area>seconds</area> = input("Please enter the number of seconds you wish to convert")</cline>
121-
<p></p>
122-
<cline><area correct ="no">hours</area> = int(<area>seconds</area>) // 3600</cline>
123-
<cline><area correxct="no">total_secs</area> = int(<area>seconds</area>)</cline>
124-
<cline><area correct="no">secs_still_remaining</area> = <area correct="no">total_secs</area> % 3600</cline>
125-
<cline>print(<area correct ="no">secs_still_remaining</area>)</cline>
127+
<cline>
128+
<area>seconds</area> = input("Please enter the number of seconds you wish to convert")</cline>
129+
<p></p>
130+
<cline>
131+
<area correct ="no">hours</area> = int(<area>seconds</area>) // 3600</cline>
132+
<cline>
133+
<area correct="no">total_secs</area> = int(<area>seconds</area>)
134+
</cline>
135+
<cline>
136+
<area correct="no">secs_still_remaining</area> = <area correct="no">total_secs</area> % 3600</cline>
137+
<cline>print(<area correct ="no">secs_still_remaining</area>)
138+
</cline>
126139

127140

128141
</areas>

0 commit comments

Comments
 (0)