NEUBIAS / training-resources

Resources for teaching/preparing to teach bioimage analysis
https://neubias.github.io/training-resources
Other
48 stars 21 forks source link

For loops: Simplify? #716

Closed tischi closed 2 months ago

tischi commented 3 months ago

Hi @felixS27,

  1. This line contains relatively advanced string printing. I would say that either we simplify this, or we should make the "string manipulation" module a prerequisite of this module. What do you think (ping @k-dominik)?

  2. This should become a separate activity, otherwise inexperienced teacher may think that they need to show this. OK for you? To do so, the module would need to be refactored to become multi-activities. I can do this...

jhennies commented 3 months ago

Also this one raises quite some questions, do we need it?

tischi commented 3 months ago

I would also remove this and put it into an advanced for-loop activity.

tischi commented 3 months ago

Also this one raises quite some questions, do we need it?

Not sure, it is a bit advanced, but it does make the point that you could iterate over "what-ever" as along it is a list....

jhennies commented 3 months ago

I would also remove this and put it into an advanced for-loop activity.

I agree, I think the enumerate version is enough here and the zip functionality is advanced. Also then you could show an actual use case for the zip functionality, since here one would always use the enumerate

tischi commented 3 months ago

Regarding the advanced string printing, I think actually making the string manipulation a prerequisite of this module could be OK.

This would allow us to teach something useful like:

for index in indices:
    print(f"Analyzing {index}/{len(indices)}")
felixS27 commented 3 months ago

Also this one raises quite some questions, do we need it?

Not sure, it is a bit advanced, but it does make the point that you could iterate over "what-ever" as along it is a list....

I would keep it in, because as @tischi said, it just shows that you can iterate over anything in a list

felixS27 commented 3 months ago

I would also remove this and put it into an advanced for-loop activity.

I agree, I think the enumerate version is enough here and the zip functionality is advanced. Also then you could show an actual use case for the zip functionality, since here one would always use the enumerate

Okay, then I will move it to the advanced section and maybe make an example with pairs of coordinates?

felixS27 commented 3 months ago

Hi @felixS27,

  1. This line contains relatively advanced string printing. I would say that either we simplify this, or we should make the "string manipulation" module a prerequisite of this module. What do you think (ping @k-dominik)?
  2. This should become a separate activity, otherwise inexperienced teacher may think that they need to show this. OK for you? To do so, the module would need to be refactored to become multi-activities. I can do this...

I will change it and make two scripts out of it.

felixS27 commented 2 months ago

I split the script into "beginner" and "advanced". So from my side, we can close this issue, if everyone agrees.

tischi commented 2 months ago

Yes, thanks a lot!!