+ 1
Best Python Calculator Code
What do you think? https://sololearn.com/compiler-playground/cvmeOFQYuBz3/?ref=app
4 Respostas
+ 1
# print("______") # DRY : Don't Repeat Yourself!
why don't you add a constant, for instance: DIVIDER = print("______")
+ 1
Is there any modification
+ 1
Thank you
+ 1
Houache Yacine
you can use multiline strings, functions to execute repeated code and the 'in' keyword for your if-elif condtions.
Also, do input validation for the numbers and zero-checking for your division.
maybe something like this:
https://sololearn.com/compiler-playground/cr9TryiMERG5/?ref=app