MolSSI-Education / python_scripting_cms

Python Data and Scripting course for computational chemists
https://molssi-education.github.io/python_scripting_cms
Other
83 stars 33 forks source link

Introduce `elif` concept #59

Open khoivan88 opened 4 years ago

khoivan88 commented 4 years ago

Hi, thank you for the tutorial. I just have a suggestion on the use of elif clause instead of just if clause in this block: https://github.com/MolSSI-Education/python_scripting_cms/edit/gh-pages/_episodes/02-file_parsing.md#L256-L268

...
for line in saptlines:
    if 'Electrostatics    ' in line:
        electro_line = line
        important_lines.append(electro_line)
    if 'Exchange       ' in line:
        exchange_line = line
        important_lines.append(exchange_line)
    if 'Induction      ' in line:
        induction_line = line
        important_lines.append(induction_line)
    if 'Dispersion     ' in line:
        dispersion_line = line
        important_lines.append(dispersion_line)
...
janash commented 4 years ago

Thank you! I think we may be able to introduce elif (and else in lesson 1 under the heading "making choices"). We use an if statement to get number less than 0, elif could be used to capture numbers equal to zero, and else to get all else.

https://github.com/MolSSI-Education/python_scripting_cms/edit/gh-pages/_episodes/01-introduction.md#L344-384

Nandini1071 commented 7 months ago

is this issue still open ?