Skip to content

Py DS_Engineer Lab Report #04

Amy Lin edited this page Jul 2, 2017 · 11 revisions

Python Programming for Data Scientists & Engineers Lab #04

Lab #04-a Ordered Dictionary



Transform a dictionary into an OrderedDict by using OrderedDict in library collections.

Sorted key and value in the dictionary using lambda.

Index[0] is for key and index[1] for value.


Lab #04-b Mash Dictionaries



Original input list has several same dictionaries.

The first one has a string value and the rest of the two have integer values.



Integer values are added together and average out. The keys of the integers are put into one string.

Update the dictionary with the combo key and mean values.


Lab #04-c Comma Separated Sequence



Prompt user for how many words to put in the list.

Sorted the word list by alphabetical order.



If the sentence is entered by the user, the program will automatically split into words.

The words will then be placed into the list and be sorted by alphabetical order.

The user won't be prompted for a second word if the number of words broken down from the sentence exceeds the input number that the user wants.


Lab #04-d Symmetric Difference



Get the symmetric difference of set "CS" and "FIN" by using symmetric ^. Output is the ones that they don't have in common.

Clone this wiki locally