Calculator Problem
David Hutto
dwightdhutto at gmail.com
Tue Feb 4 10:43:23 EST 2014
On Sunday, February 2, 2014 4:16:44 PM UTC-5, 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()
Can anyone point out how using an int as a var is possible, unless it's something I miss that changed in 3.3 from 3.2:
david at david:~$ python3.2
Python 3.2.3 (default, Sep 25 2013, 18:25:56)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 7 = float(input('First Number:'))
File "<stdin>", line 1
SyntaxError: can't assign to literal
>>>
david at david:~$ python
Python 2.7.3 (default, Sep 26 2013, 20:08:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 7 = float(input('First Number:'))
File "<stdin>", line 1
SyntaxError: can't assign to literal
>>>
More information about the Python-list
mailing list