After learning python for a while i decided to try out what i learnt, so i decided to try and make a simple calculator.

This is what i got:

def show_menu(): print "**********Calculator**********" print "1.Addition\n" print "2.Subtraction\n" print "3.Multiplication\n" print "4.Division\n" print "5.Quit\n" return input("Please enter selection:" ) def add(): num1 = input("Enter your first number: ") num2 = input("Enter your second number: ") num3 = num1 + num2 print num3 def sub(): num1 = input("Enter your first number: ") num2 = input("Enter your second number: ") num3 = num1 - num2 print num3 def mul(): num1 = input("Enter your first number: ") num2 = input("Enter your second number: ") num3 = num1 * num2 print num3 def div(): num1 = input("Enter your first number: ") num2 = input("Enter your second number: ") num3 = num1 / num2 print num3 running = 1 while running: selection = show_menu() if selection == 1: add() elif selection == 2: sub() elif selection == 3: mul() elif selection == 4: div() elif selection == 5: quit

Is this code ok?? Was there a better way/easier way that i could of done it.

I'm going to keep going with this my next plan is to try and learn wxpython and create an interface for it.