lc-python-intro icon indicating copy to clipboard operation
lc-python-intro copied to clipboard

Suggestion on Conditionals Episode

Open geospatial-gill opened this issue 4 years ago • 2 comments

With the Conditionals episode, examples are given using the variable mass or m inconsistently throughout the page. Although the code executes without errors, it would be kinder to a beginning learner to keep things consistent. Perhaps spell out the variable in the first exercise, then use it as a teaching opportunity to show how it can be safely abbreviated, for ease of writing/re-writing the code:

First example:

mass = 3.54
if mass > 3.0:
    print(mass, 'is larger')

Then:

masses = [3.54, 2.07, 9.22, 1.86, 1.71]
for m in masses:
    if m > 3.0:
        print(m, 'is larger')

I'm afraid the example in the elif section has a mix of both, which prompted me to make this suggestion:

masses = [3.54, 2.07, 9.22, 1.86, 1.71]
for mass in masses:
    if m > 9.0:
        print(m, 'is HUGE')
    elif m > 3.0:
        print(mass, 'is larger')
    else:
        print(mass, 'is smaller')

geospatial-gill avatar Nov 16 '21 21:11 geospatial-gill

Thanks @geospatial-gill. There is a major redesign planned for this part. We will keep the issue open.

konrad avatar Nov 20 '21 19:11 konrad

Hi @konrad, Please let me know if you need any Testers for the redesigned lessons!

geospatial-gill avatar Nov 22 '21 21:11 geospatial-gill

Closing since a major update to the lesson will soon be merged, deprecating most standing issues. Thanks for your contribution!

chennesy avatar Jun 14 '24 13:06 chennesy