alexmojaki / alexmojaki/futurecoder

Swap variables exercise

未關閉
#82 7 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
course material discussion
主要語言
Python
星號
1.5k
分支
183
PR 合併指標
30 天內沒有已合併 PR

描述

Maybe we should add an exercise at the end of the variables chapter where users have to swap variables in the classic way:

```python
x = 'x'
y = 'y'

z = x
x = y
y = z

print(x)
print(y)
```

Getting this right would reinforce their understanding of variables. However it's quite tricky for a beginner, so I think we should make it easier for them. There's many possible ways to do this. One possibility is to give them a bunch of possible lines to choose from:

```
x = x
x = y
x = z
y = x
y = y
y = z
z = x
z = y
z = z
```

and they have to pick the ones to put in the middle to solve the problem. Chances are they will first try `x = y; y = x` and when that doesn't work they realise the `z` lines are actually there for a reason. Thoughts?

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。