added reading.md
This commit is contained in:
34
reading.md
Normal file
34
reading.md
Normal file
@@ -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)
|
||||
```
|
||||
Reference in New Issue
Block a user