Code Monkey home page Code Monkey logo

Comments (5)

rudrathegreat avatar rudrathegreat commented on June 26, 2024 10

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

from my_first_calculator.py.

elsilentforce avatar elsilentforce commented on June 26, 2024 6

I guess this is not the best way to solve the problem, for me, the calculator is doing it's job very well.

from my_first_calculator.py.

nithilan4 avatar nithilan4 commented on June 26, 2024

I really like how he's doing it, I don't think it needs to be changed...

from my_first_calculator.py.

rudrathegreat avatar rudrathegreat commented on June 26, 2024

As @AceLewis points out -

Read the readme and you may get some context. This is not supposed to be good code it is literally a joke.

And as @elsilentforce says -

I guess this is not the best way to solve the problem, for me, the calculator is doing it's job very well.

Plus most of the issues here are not really issues but a bunch of funny conversations. As @v1993 comments -

Just for lulz probably

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. -

Put a calculator in a function to call this function again when the code ends - @Artaman

And many people are saying that the code is crashing their browsers -

I haet u. u crashed my browser - @TheInitializer
Same issue here - @ahmedouvic

So this why I think that -

  1. This is the best way to increase efficiency of the code
  2. Add more functionality without crashing anybody browsers

😄

from my_first_calculator.py.

rudrathegreat avatar rudrathegreat commented on June 26, 2024

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

from my_first_calculator.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.