<commit_before>---
num: "h05"
desc: "Guttag, Sections 4.5 and 4.6 (skipping 4.4)"
ready: false
assigned: 2016-08-10 09:00:00.00-7:00
due: 2016-08-12 09:00:00.00-7:00
---

So far, the assigned reading in Guttag has included Chapters 1, 2, 3, and sections 4.1, 4.2 and 4.3 of Chapter 4.

As for section 4.4, you may either read it, or skip over it.  It covers "global variables", and while the topic is
interesting, you will probably not have an occasion to need these during SPIS.   In fact, we would generally strongly discourage you from using them.   Guttag is correct that they are sometimes just what is needed, but it unlikely that you will encounter one of those situations.  If you think you need one, there is probably a better way to accomplish what you 
are trying to do. 

Sections 4.5 and 4.6 covers modules and files.  Those are the sections we'd like you to read for this homework assignment.

<ol>

<li markdown="1" style="margin-bottom:8em;">


</li>





<li markdown="1" style="margin-bottom:8em;" class="page-break-before">

(10 pts) In your own words, how are tuples and lists different?

</li>


<li markdown="1" style="margin-bottom:8em;" >

(10 pts) Find Figure 5.4 Methods associated with lists on page 62. Let L = [1,(1,2),'APS'], e = 1, i = 2, L1 = [4, 'Phill'].
For each method in the list, either write L if it was mutated or write what the method returns. (assume the methods are called in that order so that L may change from one method to another.)

* L.append(e)
* L.count(e)
* L.insert(i,e)
* L.extend(L1)
* L.remove(e)
* L.index(e)
* L.pop(e)
* L.sort() (Why do you think it sorts it the way it does?)
* L.reverse()<commit_msg>Update h05.md<commit_after>---
num: "h05"
desc: "Guttag, Sections 4.5 and 4.6 (skipping 4.4)"
ready: false
assigned: 2016-08-10 09:00:00.00-7:00
due: 2016-08-12 09:00:00.00-7:00
---

So far, the assigned reading in Guttag has included Chapters 1, 2, 3, and sections 4.1, 4.2 and 4.3 of Chapter 4.

As for section 4.4, you may either read it, or skip over it.  It covers "global variables", and while the topic is
interesting, you will probably not have an occasion to need these during SPIS.   In fact, we would generally strongly discourage you from using them.   Guttag is correct that they are sometimes just what is needed, but it unlikely that you will encounter one of those situations.  If you think you need one, there is probably a better way to accomplish what you 
are trying to do. 

Sections 4.5 and 4.6 covers modules and files.  Those are the sections we'd like you to read for this homework assignment.

<ol>

<li markdown="1" style="margin-bottom:8em;">
On page 63, Guttag attempts to write a function removeDups(L1,L2) that removes all elements from L1 that are also in L2.
Explain in your own words why this algorithm did not work in the way he intended on the input L1 = [1,2,3,4], L2 = [1,2,5,6].

</li>





<li markdown="1" style="margin-bottom:8em;" class="page-break-before">

(10 pts) In your own words, how are tuples and lists different?

</li>


<li markdown="1" style="margin-bottom:8em;" >

(10 pts) Find Figure 5.4 Methods associated with lists on page 62. Let L = [1,(1,2),'APS'], e = 1, i = 2, L1 = [4, 'Phill'].
For each method in the list, either write L if it was mutated or write what the method returns. (assume the methods are called in that order so that L may change from one method to another.)

* L.append(e)
* L.count(e)
* L.insert(i,e)
* L.extend(L1)
* L.remove(e)
* L.index(e)
* L.pop(e)
* L.sort() (Why do you think it sorts it the way it does?)
* L.reverse()
{'fraction_non_alphanumeric': 0.1109865470852018, 'fraction_numerical': 0.052130044843049325, 'mean_word_length': 3.797043010752688, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '592472', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1177, 'n_words': 552}