alexmojaki / alexmojaki/futurecoder

Swap variables exercise

Ouverte
#82 7 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
course material discussion
Langage dominant
Python
Étoiles
1.5k
Forks
183
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.