alexmojaki / alexmojaki/futurecoder

Parsons problems as exercises

Abierto
#95 0 comentarios 0 reacciones 0 asignados Ver en GitHub
course material frontend
Lenguaje dominante
Python
Estrellas
1.5k
Forks
183
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Currently users may solve Parsons problems when they ask for a solution to an exercise. There should also be a way to specify an entire exercise as a Parsons problem from the beginning. This would be great way to make difficult exercises easier while still being effective for learning.

Doing this mostly requires refactoring the current frontend code.

Here's an example of a program that could be nice to frame as a Parsons problem. It's a crude simulation of a pandemic, which some people might find relevant...

```python
import random

people = []

for _ in range(10000):
people.append("healthy")

people[random.randrange(len(people))] = "infected"

for day in range(100):
print("Day", day)
for kind in ["healthy", "infected", "recovered"]:
print(kind, people.count(kind))

new_people = people.copy()
for current_index in range(len(people)):
person = people[current_index]
if person == "infected":
if random.random() < 0.1:
new_people[current_index] = "recovered"
elif random.random() < 0.5:
index = random.randrange(len(people))
if people[index] == "healthy":
new_people[index] = "infected"
people = new_people
print()
```

Example output:

```
Day 0
healthy 9999
infected 1
recovered 0

Day 1
healthy 9998
infected 2
recovered 0

Day 2
healthy 9996
infected 4
recovered 0

...

Day 97
healthy 122
infected 13
recovered 9865

Day 98
healthy 122
infected 11
recovered 9867

Day 99
healthy 122
infected 10
recovered 9868
```

The only concept this script requires which hasn't been covered already is importing modules, specifically the `random` module. It doesn't even need nested lists, functions, or boolean operators.

I think this program is great for getting people interested and motivated, and teach some useful ideas, but asking them to write it themselves is too much. There's plenty of complexity and subtlety, and if they get it wrong it's very hard to debug. It's not even easy to look at the output and decide if something is wrong. That's why a Parsons problem seems perfect - the exercise becomes much more manageable, but still requires plenty of thinking.

Since typing in this much code would be very tedious, I think there could be a Copy button which copies whatever is currently in the shuffled blocks into the editor.

I'm keen to hear other ideas for exercises that would be good for this format.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.