From 137de68361b720c897840f9312fbc6b68ef0a9af Mon Sep 17 00:00:00 2001 From: Alexander Ou Date: Tue, 8 Aug 2023 17:42:07 -0700 Subject: [PATCH] added reading.md --- reading.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 reading.md diff --git a/reading.md b/reading.md new file mode 100644 index 0000000..2a7b94e --- /dev/null +++ b/reading.md @@ -0,0 +1,34 @@ + +## Arguments + +What are `*args` and `**kwargs`, where are they used, and why? + +## Reading Python 1 + +Looking at the below code, write down the final values of A0, A1, ...An. + +```python +A0 = dict(zip(('a','b','c','d','e'),(1,2,3,4,5))) +A1 = range(10) +A2 = sorted([i for i in A1 if i in A0]) +A3 = sorted([A0[s] for s in A0]) +A4 = [i for i in A1 if i in A3] +A5 = {i:i*i for i in A1} +A6 = [[i,i*i] for i in A1] +``` + + +## Reading Python 2 + +What does this code output: + +```python +def f(x,l=[]): + for i in range(x): + l.append(i*i) + print(l) + +f(2) +f(3,[3,2,1]) +f(3) +```