You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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:"
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?
The text was updated successfully, but these errors were encountered: