Member Avatar
Reusable Code Snippet Calculator

It could be simplifide more, I know. I was doing it as an exersise so its rough and skecthy. But it's workable, I tested it more then 50 times.

Member Avatar
0
44
Member Avatar

This is the updated version of the Tiny Tkinter Calculator. It has more power, since you can type in functions contained in the Python math module then press the equals key. You can then move the result into memory for other calculations. The code is written in OOP class style as an exercise, still simple and hopefully very readable. Again, you are welcome to improve the functionality, but don't turn it into a HUGE calculator.

Member Avatar
4
71
Member Avatar
Reusable Code Snippet Calculator with tkinter

I needed a calculator and I didn't want to use google since my internet is slow. So I made one! Here it is. Working with it is simple. Use the number and operation keys("c" for clear, "p" for pi, and "s" for sqrt) as well as the return and enter key, for equals, or just use the button gui! Hope you like it! The only thing I would really like to work on is the gui. If some one would help me on that that would be greatly appreciated. I will be adding more operations, fixing the power button, and …

0
14
Member Avatar
Reusable Code Snippet Simple calculator

Here little debugged version of my calculator posted earlier in GUI calculator thread. I prepared it after listening that their teacher did more limited calculator in around 150 lines of code with their graphics module. This is 115 lines without empty lines and comment lines [CODE]>>> li=[i for i in open('SimplistiCalc.pyw') ... if i.strip() and not i.strip().startswith('#')] >>> len(li) 115 >>>[/CODE] Save attached gifs to same directory as the code. Comments welcome!

Member Avatar
1
36
Member Avatar

Hello. This code snippet is a basic calculator. The general concept is that the calculator accepts infix expressions as strings, converts them to reverse polish notation by way of the shunting-yard algorithm and then evaluates the resulting expression. I tried to encapsulate the functionality of each piece so that, in theory, they could be pulled out and used independently. The shunting-yard behavior is provided via `class ShuntingYard`; I used the visitor pattern for the `Token`; and `RPNExpression` could be built by hand (or some other process) and still be used with `Calculator`. I removed almost all error checking and input …

Member Avatar
2
83
Member Avatar

This is a series of 3 code snippets which together form a completly working "calculator". I used a console application in VS C# 2008, but 2005 should cause no problems. To start with : here you have the code for a scanner class. A scanner reads the inputline and tries to get some meaningfull words(sometimes called tokens) from it. It then passes that information to a parser.

Member Avatar
1
43
Member Avatar
Reusable Code Snippet Binary calculations

Very trivial program which could be thought as conclusion from the Quiz posts (thanks Gribouillis for inspiration for format)

Member Avatar
0
4
Member Avatar
Reusable Code Snippet 1/3=0 eliminator

This function I did to improve calculator program by eliminating problems with Pythons problem of dividing integer with integer and giving integer division result.

Member Avatar
0
8
Member Avatar

This is the last part. This is the code that sets it al together and lets the parser and scanner do some work. Happy calculating!

0
14
Member Avatar

Here is the second piece of code. The parser tries to interpret the tokens it gets from the scanner.

0
8
Member Avatar
Reusable Code Snippet Mortgage Calculator (Python)

Just a small Python program to calculate monthly payments and other costs. I have compared it with some of the calculators available from many of the online mortgage companies, and results seem to match.

2
5

The End.