Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65288

Re: Calculator Problem

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gary.herron@islandtraining.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'syntax': 0.04; 'elif': 0.05; '*not*': 0.07; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'def': 0.12; 'did,': 0.16; 'intended.': 0.16; 'skip:q 30': 0.16; 'subject:Problem': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'hey': 0.18; 'trying': 0.19; 'print': 0.22; 'header:User-Agent:1': 0.23; 'errors.': 0.24; 'received:emailsrvr.com': 0.24; 'sorry,': 0.24; 'guys': 0.24; 'question': 0.24; 'received:(smtp server)': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'errors': 0.30; 'program,': 0.31; 'lines': 0.31; '(since': 0.31; 'gary': 0.31; 'run': 0.32; 'running': 0.33; 'display': 0.35; 'one,': 0.35; 'but': 0.35; 'really': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'even': 0.60; 'tell': 0.60; 'full': 0.61; 'first': 0.61; 'times': 0.62; 'claim.': 0.84; 'divide': 0.84; 'happened.': 0.84; 'is)': 0.84; 'nonsense.': 0.84
X-Virus-Scanned OK
Date Sun, 02 Feb 2014 13:46:24 -0800
From Gary Herron <gary.herron@islandtraining.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Calculator Problem
References <608a3384-525b-4879-82d2-5a6414827fa7@googlegroups.com>
In-Reply-To <608a3384-525b-4879-82d2-5a6414827fa7@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6310.1391377595.18130.python-list@python.org> (permalink)
Lines 70
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391377595 news.xs4all.nl 2835 [2001:888:2000:d::a6]:57342
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65288

Show key headers only | View raw


On 02/02/2014 01:16 PM, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under the program, see what i mean by just running it , can someone help me fix this
>
> def Addition():
>      print('Addition: What are two your numbers?')
>      1 = float(input('First Number:'))
>      2 = float(input('Second Number:'))
>      print('Your Final Result is:', 1 + 2)
>
>
> def Subtraction():
>      print('Subtraction: What are two your numbers?')
>      3 = float(input('First Number:'))
>      4 = float(input('Second Number:'))
>      print('Your Final Result is:', 3 - 4)
>
>
> def Multiplication():
>      print('Multiplication: What are two your numbers?')
>      5 = float(input('First Number:'))
>      6 = float(input('Second Number:'))
>      print('Your Final Result is:', 5 * 6)
>
>
> def Division():
>      print('Division: What are your two numbers?')
>      7 = float(input('First Number:'))
>      8 = float(input('Second Number:'))
>      print('Your Final Result is:', 7 / 8)
>
>
>
> print('What type of calculation would you like to do?')
> Question = input('(Add, Subtract, Divide or Multiply)')
> if Question.lower().startswith('a'):
>              print(Addition())
> elif Question.lower().startswith('s'):
>              print(Subtraction())
> elif Question.lower().startswith('d'):
>              print(Division())
> elif Question.lower().startswith('m'):
>              print(Multiplication())
> else:
>          print('Please Enter The First Letter Of The Type Of Calculation You Would Like To Use')
>
> while Question == 'test':
>          Question()

Sorry, but in fact you did *not* run this program as you claim. It's 
full of syntax errors.  Any attempt to run it will display syntax errors 
immediately, and never actually run.   So please tell us what really 
happened.

But even without an accurate description of what you did, I can say this:

Lines like
     1 = float(...)
don't make sense.  It's as if you are trying to change the value of the 
number one, but that's nonsense.

And lines like
     print('Your Final Result is:', 5 * 6)
had better print out 30 (since that is what 5 times 6 is) but that's 
clearly not what you intended.

Gary Herron



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Calculator Problem Charlie Winn <charliewinn97@gmail.com> - 2014-02-02 13:16 -0800
  Re: Calculator Problem Alister <alister.ware@ntlworld.com> - 2014-02-02 21:39 +0000
  Re: Calculator Problem Gary Herron <gary.herron@islandtraining.com> - 2014-02-02 13:46 -0800
    Re: Calculator Problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-02 22:11 +0000
    Re: Calculator Problem Charlie Winn <charliewinn97@gmail.com> - 2014-02-03 10:04 -0800
      Re: Calculator Problem Joel Goldstick <joel.goldstick@gmail.com> - 2014-02-03 13:17 -0500
        Re: Calculator Problem Charlie Winn <charliewinn97@gmail.com> - 2014-02-03 10:25 -0800
          Re: Calculator Problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-04 00:41 +0000
      Re: Calculator Problem Roy Smith <roy@panix.com> - 2014-02-03 13:26 -0500
      Re: Calculator Problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-03 22:24 +0000
        Re: Calculator Problem Ian Kelly <ian.g.kelly@gmail.com> - 2014-02-03 16:10 -0700
      Re: Calculator Problem Gary Herron <gary.herron@islandtraining.com> - 2014-02-03 15:06 -0800
  Re: Calculator Problem David Hutto <dwightdhutto@gmail.com> - 2014-02-04 07:43 -0800
    Re: Calculator Problem David Hutto <dwightdhutto@gmail.com> - 2014-02-04 10:54 -0500
    Re: Calculator Problem Roy Smith <roy@panix.com> - 2014-02-04 19:53 -0500
      Re: Calculator Problem Chris Angelico <rosuav@gmail.com> - 2014-02-05 12:09 +1100
      Re: Calculator Problem Dan Sommers <dan@tombstonezero.net> - 2014-02-05 02:22 +0000
        Re: Calculator Problem Joshua Landau <joshua@landau.ws> - 2014-02-05 18:03 +0000
        Re: Calculator Problem Peter Otten <__peter__@web.de> - 2014-02-05 19:15 +0100
  Re: Calculator Problem "Mario R. Osorio" <nimbiotics@gmail.com> - 2014-02-04 14:55 -0800
  Re: Calculator Problem 88888 Dihedral <dihedral88888@gmail.com> - 2014-02-05 10:30 -0800

csiph-web