Ruby
Python
JavaScript

Search for '{{search_term}}'

Exercise: add more statistics

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

Exercise: create calculator

See other exercises.

Create a command line calucaltor that will prompt for two numbers and an operator and will calculate the result. Handle the following operators: +, -, *, and /.

An interaction should look like this:

$ mycalc
First number: 23
Second number: 19
Operator: +
Result: 42

where the numbers 23, 19 and the operator + are typed in by the user.

Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus