Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contribution: Repeating Actions with Loops #884

Open
cmil-2 opened this issue Oct 26, 2020 · 1 comment
Open

Contribution: Repeating Actions with Loops #884

cmil-2 opened this issue Oct 26, 2020 · 1 comment
Labels
type:discussion Discussion or feedback about the lesson

Comments

@cmil-2
Copy link

cmil-2 commented Oct 26, 2020

I had the experience of going through Repeating Actions with Loops in a group setting. The lesson teaches negative approaches for printing characters first, which many found confusing when following live coding.

"An example task that we might want to repeat is printing each character in a word on a line of its own.

word = 'lead'
In Python, a string is basically an ordered collection of characters, and every character has a unique number associated with it – its index. This means that we can access characters in a string using their indices. For example, we can get the first character of the word 'lead', by using word[0]. One way to print each character is to use four print statements:

print(word[0])
print(word[1])
print(word[2])
print(word[3])
l
e
a
d
This is a bad approach for three reasons:"

Could it be more beneficial to start with the good approaches earlier in the lesson?

@ldko
Copy link
Contributor

ldko commented Nov 3, 2020

Hi @cmil-2, thank your for providing feedback about the loops episode. This is a critique I have not heard come up before, so it is good to open it up to discussion.

What aspect of seeing the four print calls did the learners find confusing? Was it: what the code was doing, what the syntax with the indices meant, why we would show something in a way we would then say is "bad"?

For me, the benefit of seeing the four print calls approach first is because it shows what we want to do using syntax we have seen already, then teaches us a new way. I wonder if it would help to soften the language that calls it a "bad approach", to something like: "While we achieve the result we intended in this case, there are limitations to this approach:"

@ldko ldko added the type:discussion Discussion or feedback about the lesson label Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:discussion Discussion or feedback about the lesson
Projects
None yet
Development

No branches or pull requests

2 participants