From 992eac9314722a8fd13f297e091eb0df8b4ff0dc Mon Sep 17 00:00:00 2001 From: cindy126 Date: Wed, 4 Mar 2020 12:13:14 -0800 Subject: [PATCH] Update lect18.md --- _lectures/lect18.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/_lectures/lect18.md b/_lectures/lect18.md index 9793ab7..87b4b21 100644 --- a/_lectures/lect18.md +++ b/_lectures/lect18.md @@ -1,7 +1,27 @@ --- -num: Lec 18 +num: Lec18 lecture_date: 2020-03-04 desc: -ready: false +ready: true pdfurl: --- + +# Questions +* Question: Why would you just want to store one object in a tuple? +* Ans: If you store stuff in a tuple, the object will not change. + +```python +def printPet(aDict, key): + age = aDict[key]['age'] + pettype = aDict[key]['type'] + date = aDect[key]['date'] + format_str = "{} is a {} who is {} old and we got it on {}" + print(format_str.format(key, pettype, age, date)) + +''' +Output: +printPet(pets,'Cutie') +Cutie is a poddle who is 3 months old and we got it on 03/04/2020 +''' +``` +