[Tutor] More Advanced Calculator.
With your helps i managed to program Advanced Calculator. But, I want to change(or add) some to it. 1. How can i /n/n result bit? I tired.. but, I can't 2. How can i enable it to calculate float-pointing numbers? (Which will make it complicated) It should looks like this... Please input data Number1: Mathsmetical Sign: Number2: Result: And the source i got import operator ops_dict = {'+': operator.add, '*' : operator.mul, '-' : operator.sub, '/' : operator.div} def perform_arithmetic(): print Please input data number1 = int(raw_input(\nNumber1: )) sign = raw_input(Mathsmetics Sign: ) number2 = int(raw_input(Number2: )) try: result = ops_dict[sign](number1, number2) except KeyError: raise NotImplementedError, I don't know the sign '%s' %sign # add output formatting logic as desired return result print perform_arithmetic() raw_input() Cheers! :) _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Advanced Calculator Program...
I want to make caculator program which enables me to enter 2numbers and mathsmatics sign and calculates it. I think this is too difficult for newbie like me... Please input data Number1: Mathsmetics Sign: Number2: (Number1) (Sign) (Number2) = (Result) I wrote this but, Error occurs print Please input data number1 = int(raw_input(\nNumber1: )) sign = (raw_input(\nMathsmetics Sign: )) number2 = int(raw_input(\nNumber2: )) total = number1 sign number2 print number1, sign, number2, '=', total please help me Cheers! :) _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Problem in making calulator
No-one answered question So, I e-mail it again Help me please I wrote this to add 2 numbers... print Please input data number1 = int(raw_input( )) number2 = int(raw_input(+ )) total = number1 + number2 print total raw_input() I want to make output like this... 1 + 1 = 2 But, actually... it looks like this... 1 + 1 2 Cheers! :) _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Trivia program.
Hi, I got a problem with this program. name = raw_input("Hi. What's your name? ")called = name * 5print "\nIf a small child were trying to get your attention, " \ "your name would become:"print called When i input the name like "John Goodman" it prints like... John GoodmanJohn GoodmanJohn GoodmanJohn GoodmanJohn Goodman But i want to print it like... John Goodman John Goodman John Goodman John Goodman John Goodman How can I do it?Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Problem with variables
wrote this, It's a bit lame thoughI = "Allen"me = "Allen"my = "Allen's"print \"""%s woke up early in the morning. But, it was unusal by %s. %s pillowwas with %s. %s didn't want to wake up But, %s tried my best and woke up.it was so amazing!""" % (I,me,my,me,I,I)raw_input("\n\\t\t\t- The End -")But it looks like this...Allen woke up early in the morning. But, it was unusal by Allen. Allen's pillowwas with Allen. Allen didn't want to wake up But, Allen tried my best and woke up.it was so amazing - The End - the problem is about lining I want it to print like this... Allen woke up early in the morning. But, it was unusal by Allen. Allen's pillow was with Allen. Allen didn't want to wake up But, Allen tried my best and woke up. it was so amazing FREE pop-up blocking with the new MSN Toolbar MSN Toolbar Get it now! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Problems in making calulating program.
I wrote this to add 2 numbers...print "Please input data"number1 = int(raw_input(" "))number2 = int(raw_input("+ "))total = number1 + number2print totalraw_input("")I want to make output like this...1 + 1 = 2But, actually... it looks like this...1+ 12 Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] .
. _ .. .. .. .. .. .. .. .. MSN http://www.msn.co.kr/love/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor