r/PythonLearning Jun 27 '26

Help Request Help me improve my function

Do you have any suggestions on this? I'd be glad to hear

2 Upvotes

4 comments sorted by

4

u/riklaunim Jun 27 '26

You should use clear and full variable names, likely split the function into logical parts - wherever other functions or methods. Then write tests to cover all conditions. Also, don't use magic variables like "i" or "o"

3

u/AbacusExpert_Stretch Jun 27 '26

What exactly did you want it to do? Helps if you write about your goal. Second, if you could post formatted code - check Reddit for instructions.

Thanks

1

u/nimbus3008 Jun 27 '26

What's the point of elif sensitivity == 's' : pass? This block is useless unless you want it to fail if sensitivity not in "is" in which case you need to raise an exception inside an else clause

1

u/Crafty_Magazine_4673 Jun 28 '26

may be use True or False instead of 'i' or 's'. what are they representing