Skip to content

Commit 87eb760

Browse files
authored
Merge branch 'barbarer:master' into master
2 parents eb26ed3 + 37cba64 commit 87eb760

51 files changed

Lines changed: 1007 additions & 366 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
published
22
build
33
__pycache__
4-
.DS_Store
4+
*.DS_Store
55
*~
66
*.pyc
77
build-info
8+
.cache
9+
output/*
10+
logs/*
11+
.vscode
12+
.idea
13+
.error_schema.log
14+
build_success
15+
build.log
16+
.web_assets.pkl

_sources/functions/funcWithSetsAndDict.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ You can also check if an item is in a set.
5151
print(1 in s1)
5252
print(9 in s1)
5353

54-
.. fillintheblank:: funct_tuple_test_char
54+
.. fillintheblank:: funct_set_tuple_test_char
5555
:practice: T
5656

5757
What characters are used to inintialize the values in a set in the code above?
@@ -253,7 +253,7 @@ You can use the following methods with sets.
253253
print(s1.symmetric_difference(s2))
254254
print(s1 ^ s2)
255255

256-
.. fillintheblank:: funct_exor_fitb
256+
.. fillintheblank:: funct_set_exor_fitb
257257
:practice: T
258258

259259
What character is used to find the symmetric difference (exlusive or) between two sets in the code above?
@@ -355,15 +355,15 @@ Dictionaries
355355

356356
A dictionary stores a value for a key. The keys must be immutable and unique.
357357

358-
.. fillintheblank:: funct_dict_num_t
358+
.. fillintheblank:: funct_set_dict_num_t
359359

360360
What is the first thing the code below prints?
361361

362362
- :2: It prints the number of t's in the string.
363363
:3: A 'T' is different from a 't'.
364364
:.*: Try again!
365365

366-
.. activecode:: func_dict_example
366+
.. activecode:: func_set_dict_example
367367
:caption: Example with a dictionary
368368

369369
Run this code to see what it prints.
@@ -385,12 +385,12 @@ A dictionary stores a value for a key. The keys must be immutable and unique.
385385
print(d1)
386386
print(type(d1))
387387

388-
.. shortanswer:: func_dict_key_error_sa
388+
.. shortanswer:: func_set_dict_key_error_sa
389389

390390
Look at the Python code below. What do you think will happen when you run the following code?
391391

392392

393-
.. activecode:: func_dict_with_key_error
393+
.. activecode:: func_set_dict_with_key_error
394394
:caption: Example with a dictionary
395395

396396
Run this code to see what it prints.
@@ -402,7 +402,7 @@ A dictionary stores a value for a key. The keys must be immutable and unique.
402402

403403
There is another way to update the value for a key that works even if the key isn't in the dictionary already.
404404

405-
.. activecode:: func_dict_example_v2
405+
.. activecode:: func_set_dict_example_v2
406406
:caption: Example with a dictionary
407407

408408
Run this code to see what it prints.
@@ -467,5 +467,5 @@ There is another way to update the value for a key that works even if the key is
467467

468468
If you worked in a group, you can copy the answers from this page to the other group members. Select the group members below and click the button to share the answers.
469469

470-
.. groupsub:: func_tuplesanddict_groupsub
470+
.. groupsub:: func_set_tuplesanddict_groupsub
471471
:limit: 3

_sources/functions/func_Str_Cond.rst

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ in groups on activities and each member has an assigned role. For more informat
88

99
If you work in a group, have only one member of the group fill in the answers on this page. You will be able to share your answers with the group at the bottom of the page.
1010

11-
**Learning Objectives**
11+
Learning Objectives
12+
====================
1213

1314
Students will know and be able to do the following.
1415

@@ -131,6 +132,8 @@ a string covers more than one line.
131132
String Indices
132133
==================
133134

135+
You can get a character from a string at an index (position) using ``string[index]``.
136+
134137
.. fillintheblank:: fsc_fitb_pogil_initials_v2
135138

136139
What is the last thing that will be printed when the code below runs?
@@ -141,7 +144,7 @@ String Indices
141144
.. activecode:: fsc_ac_pogil_initials_v2
142145
:caption: get_initials
143146

144-
Run the code below to see what it prints. Then fix it to pass the given test. It should return a string with the
147+
Run the code below to see what it prints. Then fix it to pass the test shown below the code. It should return a string with the
145148
first character of the first name and first character of the last name.
146149
~~~~
147150
# function definition
@@ -160,6 +163,7 @@ String Indices
160163
# function call
161164
main()
162165

166+
====
163167
from unittest.gui import TestCaseGui
164168
class myTests(TestCaseGui):
165169

@@ -172,13 +176,15 @@ String Indices
172176

173177
.. note::
174178

175-
Use [index] to get a character from a string. The first character in a string is at index 0 and the last is at the length of the string minus 1 (also know as index -1 in Python).
179+
Use ``string[index]`` to get a character from a string. The first character in a string is at index 0 and the last is at the length of the string minus 1 (also know as index -1 in Python).
176180

177181
Fix the function ``get_initials`` above to return a string with the first letter of the first name followed by the first letter of the last name.
178182

179183
String Slices
180184
==================
181185

186+
You can get a copy of part or all of a string using ``str_name[start:end]``.
187+
182188
.. fillintheblank:: fsc_fitb_pogil_short_name
183189

184190
What is the last thing that will be printed when the code below runs?
@@ -217,6 +223,14 @@ String Slices
217223
- :dna\[0\:3\]|\[:3\]: This will return a new string with the characters from index 0 to 2.
218224
:.*: Look at the note above and try again.
219225

226+
.. fillintheblank:: fsc_fitb_len_string
227+
:practice: T
228+
229+
What built-in function tells you the number of characters in a string?
230+
231+
- :len: The len function takes a string and returns the number of characters in it.
232+
:.*: Look at the example code above.
233+
220234

221235
Basic Conditionals and Tests
222236
============================
@@ -237,13 +251,13 @@ Basic Conditionals and Tests
237251
# function definition
238252
def get_temp_desc(temp):
239253
if temp < 32:
240-
return "Baby, its cold outside!"
254+
return "Baby, its cold outside! The temp is " + str(temp)
241255
elif temp < 70:
242-
return "Wear a coat"
256+
return "Wear a coat The temp is " + str(temp)
243257
elif temp < 80:
244-
return "Feels great!"
258+
return "Feels great! The temp is " + str(temp)
245259
else:
246-
return "Too hot to handle!"
260+
return "Too hot to handle! The temp is " + str(temp)
247261

248262
# function definition
249263
def main():
@@ -253,6 +267,10 @@ Basic Conditionals and Tests
253267
# function call
254268
main()
255269

270+
.. note::
271+
272+
You must first convert a number to a string using ``str(nun)`` if you want to add it to a string using ``+``.
273+
256274
.. fillintheblank:: fsc_fitb_pogil_elif
257275

258276
What keyword is used in a conditional statement when you want three of more possible outcomes?
@@ -286,9 +304,6 @@ Basic Conditionals and Tests
286304
# function call
287305
main()
288306

289-
.. note::
290-
291-
You must first convert a number to a string using ``str(nun)`` if you want to add it to a string using ``+``.
292307

293308
.. parsonsprob:: fsc_pogil_check-guess-Parsons-v2
294309
:numbered: left

_sources/tuples/mixedupcode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Tuples Mixed-Up Code Questions
1+
Mixed-Up Code Questions
22
------------------------------
33

44
.. selectquestion:: Tups_MixedUpCode_1_sq

_sources/tuples/mixedupcode_orig.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Mixed-Up Code Questions
2-
------------------------
1+
Mixed-Up Code Questions - Source
2+
--------------------------------
33

44
.. parsonsprob:: tup_mixedupcode_1
55
:numbered: left

generated-assets/trace/chp13_improveconstructor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)