My first Python script

After a tutorial about Python on NetTuts I decided to create my first python script: a simple calculator.

And here is the result:

 1print "Welcome to the calculator";
 2nr1 = raw_input("The first number: ");
 3what = raw_input("What do you want to do (+, -, *, /): ");
 4nr2 = raw_input("The second number: ");
 5 
 6print "";
 7print "The outcome is:";
 8 
 9if what == "+":
10    print int(nr1) + int(nr2);
11elif what == "-":
12    print int(nr1) - int(nr2);
13elif what == "*":
14    print int(nr1) * int(nr2);
15elif what == "/":
16    print int(nr1) / int(nr2);
© 2026 Jurjen