Srpn is a reverse polish notation calculator with the extra feature that all arithmetic is saturated (i.e. when it reaches the maximum value that can be stored in a variable, it stays at the maximum rather than wrapping around).

Program must be able to input at least two numbers and perform one operation correctly and output:
Input:
10
2
+
=
Also with -,/,*,%

can anyone help me asap pls?

Sorry, but I'm fairly new to Python too.
Like this?

def main():
    choice = ''
    while choice != '6':
        print """Main Menu:
                1 Add
                2 Subtract
                3 Multiply
                4 Divide
                5 Modulus
                6 Quit"""
        choice = raw_input("\nSelect: ")
        if choice == '1':
            print "+++ Add +++"
            input1 = input("First Number: ")
            input2 = input("Second Number: ")
            print "The sum is", input1 + input2
        elif choice == '2':
            print "--- Subtract ---"
            input1 = input("First Number: ")
            input2 = input("Second Number: ")
            print "The difference is", input1 - input2
        elif choice == '3':
            print "*** Multiply ***"
            input1 = input("First Number: ")
            input2 = input("Second Number: ")
            print "The product is", input1 * input2
        elif choice == '4':
            print "/// Divide ///"
            input1 = input("First Number: ")
            input2 = input("Second Number: ")
            print "The quotient is", input1 / input2
        elif choice == '5':
            print "%%% Modulus %%%"
            input1 = input("First Number: ")
            input2 = input("Second Number: ")
            print "The modulus for", input1, "and", input2, "is", input1 % input2
        elif choice == '6':
            print "Quitting."
        else:
            print "Invalid choice. Returning to main menu."
        print "\n"*3
main()

HTH,
Azul-P

actually no. Program must be able to input at least two numbers and perform one operation correctly and output:
Input:
10
2
+
=
Input:
11
3
-
=
Input:
9
4
*=
Input:
11
3
/
=
Input:
Program must be able to handle multiple numbers and multiple operations
Input:
3
3
*4
4
*+
=
Input:
1234
2345
3456
d
+
d
+
d
=
in order to do this i think it will use stack but i have no idea how to write the code.

What operation is d?
What do you mean by "maximum value that can be stored in a variable". Is this an arbitrary number?
The following "it stays at the maximum" means that no operation is performed afterwards?
Is there any unary operator?
What is the expected output for that? :
3
3
*4
4
*+
=

How about that ?

This article has been dead for over six months. Start a new discussion instead.