alexmojaki / alexmojaki/futurecoder

Swap variables exercise

オープン
#82 コメント 7 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。