[Tutor] python arthematics

Prasad, Ramit ramit.prasad at jpmorgan.com
Fri Mar 23 15:18:15 CET 2012


Please reply to the list (or at least include it) and not just 
the person responding.

> i have tried upto two varibles but i want it to extend to mny more . I
> just need an idea. i have tried like this
> a=int(raw_input())
> b=int(raw_input())
> print "please enter operator"
> operator=raw_input()
> if operator == "+":
>         c=a+b
>         print c
> elif operator == "-":
>     c=a-b
>     print c
> elif operator == "/":
>     c=a/b
>     print c
> elif operator == "*":
>     c=a*b
>     print c

The easiest thing to do would be to put this in a loop and use 
the result as 'a'. This would not help with order of operations, 
but you can leave that to the user. Dumb, but much like a non-
scientific calculator.

Alan has already provided you with other options, but be warned
they are not beginner-level projects.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list