-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Needs to Be a Bit Shorter #32
Comments
I guess this is not the best way to solve the problem, for me, the calculator is doing it's job very well. |
If you think the existing code is relevant, that is fine. There can be more functionality and you can simply add functionality by import 'math'. import math
math.sqrt(num) Plus the existing code has limitations, only going up to an extent. If you want a calculator that can give you answers to questions involving big numbers, then you can cut down the code a lot and add new functionality in the lines he has already used. Simply - import math
def add(num1 = None, num2 = None):
answer = num1 + num2
return answer
def subtract(num1 = None, num2 = None):
answer = num1 - num2
return answer
def multiply(num1 = None, num2 = None):
answer = num1 * num2
return answer
def divide(num1 = None, num2 = None):
answer = num1/num2
return answer
# And so on And plus he can add a GUI to his program using Tkinter. What's more is that you can use NumPy for certain operations as well |
I really like how he's doing it, I don't think it needs to be changed... |
As @AceLewis points out -
And as @elsilentforce says -
Plus most of the issues here are not really issues but a bunch of funny conversations. As @v1993 comments -
And most people are now saying that if this code is ever going to change or be optimised, then the best way is to make functions and calling them whenever you want. -
And many people are saying that the code is crashing their browsers -
So this why I think that -
😄 |
I think this issue has already had a satisfying answer, that the my_first_calculator.py code was generated by another piece of code called generator.py. So, I am going to be closing this issue |
Your code is great but could you make it a bit shorter. You can add methods with parameters 'sign', 'num1' and 'num2'
The text was updated successfully, but these errors were encountered: