Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65285 > unrolled thread
| Started by | Charlie Winn <charliewinn97@gmail.com> |
|---|---|
| First post | 2014-02-02 13:16 -0800 |
| Last post | 2014-02-05 10:30 -0800 |
| Articles | 20 on this page of 21 — 15 participants |
Back to article view | Back to comp.lang.python
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
Page 1 of 2 [1] 2 Next page →
| From | Charlie Winn <charliewinn97@gmail.com> |
|---|---|
| Date | 2014-02-02 13:16 -0800 |
| Subject | Calculator Problem |
| Message-ID | <608a3384-525b-4879-82d2-5a6414827fa7@googlegroups.com> |
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()
[toc] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2014-02-02 21:39 +0000 |
| Message-ID | <mWyHu.1829$AZ.1771@fx13.am4> |
| In reply to | #65285 |
On Sun, 02 Feb 2014 13:16:44 -0800, 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()
your functions need to return values not print them.
I would also ask for the inputs before calling the functions
I suggest you ask your tutor to go into more details if how to do this
has not already been explained in your lessons.
--
> Tut mir Leid, Jost, aber Du bist ein unertraeglicher Troll.
Was soll das? Du *beleidigst* die Trolle!
-- de.comp.os.unix.linux.misc
[toc] | [prev] | [next] | [standalone]
| From | Gary Herron <gary.herron@islandtraining.com> |
|---|---|
| Date | 2014-02-02 13:46 -0800 |
| Message-ID | <mailman.6310.1391377595.18130.python-list@python.org> |
| In reply to | #65285 |
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
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-02-02 22:11 +0000 |
| Message-ID | <lcmfps$h0f$1@dont-email.me> |
| In reply to | #65288 |
On Sun, 02 Feb 2014 13:46:24 -0800, Gary Herron wrote: > Sorry, but in fact you did *not* run this program as you claim. +1 I can also see a call to a function named Question, but I can't see where that function is defined. That might not be a major issue, because I don't think the while condition that leads to the function call is ever fulfilled anyway. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Charlie Winn <charliewinn97@gmail.com> |
|---|---|
| Date | 2014-02-03 10:04 -0800 |
| Message-ID | <61630cc4-a9fe-4936-a86e-65c891224a63@googlegroups.com> |
| In reply to | #65288 |
On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
> 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
excuse me but don't be so ******* rude , i did run this program and it did run correctly and if you want me to prove it with screenshots so be it , so don't make accusations ** Gary ** i only came here for some help not to be accused of not even running my program
Charlie :D
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2014-02-03 13:17 -0500 |
| Message-ID | <mailman.6350.1391451473.18130.python-list@python.org> |
| In reply to | #65353 |
[Multipart message — attachments visible in raw view] — view raw
On Feb 3, 2014 1:05 PM, "Charlie Winn" <charliewinn97@gmail.com> wrote:
>
> On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
> > 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:'))
You can't name a variable a number
> >
> > > 2 = float(input('Second Number:'))
> >
> > > print('Your Final Result is:', 1 + 2)
You should a result, then print it after the function.
> > >
> >
> > >
> >
> > > 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
>
> excuse me but don't be so ******* rude , i did run this program and it
did run correctly and if you want me to prove it with screenshots so be it
, so don't make accusations ** Gary ** i only came here for some help not
to be accused of not even running my program
If you can run this, cut and paste the results
>
> Charlie :D
> --
> https://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | Charlie Winn <charliewinn97@gmail.com> |
|---|---|
| Date | 2014-02-03 10:25 -0800 |
| Message-ID | <413998dd-b101-46e4-9012-c79c2cd66cf0@googlegroups.com> |
| In reply to | #65354 |
On Monday, February 3, 2014 6:17:44 PM UTC, Joel Goldstick wrote:
> On Feb 3, 2014 1:05 PM, "Charlie Winn" <charli...@gmail.com> wrote:
>
> >
>
> > On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
>
> > > 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:'))
>
> You can't name a variable a number
>
> > >
>
> > > > 2 = float(input('Second Number:'))
>
> > >
>
> > > > print('Your Final Result is:', 1 + 2)
>
> You should a result, then print it after the function.
>
> > > >
>
> > >
>
> > > >
>
> > >
>
> > > > 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
>
> >
>
> > excuse me but don't be so ******* rude , i did run this program and it did run correctly and if you want me to prove it with screenshots so be it , so don't make accusations ** Gary ** i only came here for some help not to be accused of not even running my program
>
>
> If you can run this, cut and paste the results
>
> >
>
> > Charlie :D
>
> > --
>
> > https://mail.python.org/mailman/listinfo/python-list
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
What type of calculation would you like to do?
(Add, Subtract, Divide or Multiply)a
Addition: What are two your numbers?
First Number:5
Second Number:96
Your Final Result is: 101.0
None
>>>
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2014-02-04 00:41 +0000 |
| Message-ID | <lcpcv2$vog$7@dont-email.me> |
| In reply to | #65355 |
On Mon, 03 Feb 2014 10:25:37 -0800, Charlie Winn wrote:
> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64
> bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for
> more information.
>>>> ================================ RESTART
>>>> ================================
>>>>
> What type of calculation would you like to do?
> (Add, Subtract, Divide or Multiply)a Addition: What are two your
> numbers?
> First Number:5 Second Number:96 Your Final Result is: 101.0 None
>>>>
That wasn't obtained from running the code you posted.
Your code *as you posted it* gives:
$ python charlie.py
File "charlie.py", line 4
1 = float(input('First Number:'))
SyntaxError: can't assign to literal
$
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-02-03 13:26 -0500 |
| Message-ID | <roy-A399E5.13262203022014@news.panix.com> |
| In reply to | #65353 |
Charlie Winn <charliewinn97@gmail.com> wrote:
> excuse me but don't be so ******* rude , i did run this program and it did
> run correctly and if you want me to prove it with screenshots so be it , so
> don't make accusations ** Gary ** i only came here for some help not to be
> accused of not even running my program
Hi Charlie,
I don't think anybody doubts that you ran your program. More likely,
the code that you ran simply isn't the code that you posted. When
posting code, it's best to copy-paste the exact code you ran.
You posted 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)
That code could not have been what you ran, because it's not runnable.
It's a syntax error (in both Python 2 and 3).
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-02-03 22:24 +0000 |
| Message-ID | <52f0173a$0$29972$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #65353 |
On Mon, 03 Feb 2014 10:04:35 -0800, Charlie Winn wrote:
> excuse me but don't be so ******* rude , i did run this program and it
> did run correctly
Charlie, you may have run *some* program, but it wasn't the program you
posted here. And if it ran correctly, why are you asking for help?
The code you ran and the code you posted here are not the same, because
the code you posted will not run due to multiple syntax errors. If you
had tried to run *that* program you would have received multiple syntax
errors:
py> 1 = float(input('First Number:'))
File "<stdin>", line 1
SyntaxError: can't assign to literal
So you must have run a different program. Please show us the program you
*actually* used, and then we can help you.
--
Steven
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-02-03 16:10 -0700 |
| Message-ID | <mailman.6372.1391469028.18130.python-list@python.org> |
| In reply to | #65384 |
[Multipart message — attachments visible in raw view] — view raw
On Feb 3, 2014 3:26 PM, "Steven D'Aprano" < steve+comp.lang.python@pearwood.info> wrote: > > On Mon, 03 Feb 2014 10:04:35 -0800, Charlie Winn wrote: > > > excuse me but don't be so ******* rude , i did run this program and it > > did run correctly > > Charlie, you may have run *some* program, but it wasn't the program you > posted here. And if it ran correctly, why are you asking for help? He said previously that he doesn't want it printing the None after the result. I think that was already answered though: Assuming that the code being run is structurally similar to what was posted, it prints None because the calculator functions print their result instead of returning it, and then the main function also prints the return value from the calculator functions, which is None. The print should be in one place or the other, not both.
[toc] | [prev] | [next] | [standalone]
| From | Gary Herron <gary.herron@islandtraining.com> |
|---|---|
| Date | 2014-02-03 15:06 -0800 |
| Message-ID | <mailman.6371.1391468771.18130.python-list@python.org> |
| In reply to | #65353 |
On 02/03/2014 10:04 AM, Charlie Winn wrote:
> On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
>>
...
>>
>>
>> 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.
...
>>
>>
>> Gary Herron
> excuse me but don't be so ******* rude , i did run this program and it did run correctly and if you want me to prove it with screenshots so be it , so don't make accusations ** Gary ** i only came here for some help not to be accused of not even running my program
>
> Charlie :D
Sorry, it wasn't rude, it was a statement of fact pointing out an error
on your part. You may *think* you ran the code you posted, but in fact
you could not have done so. The code you posted will not run. Not in
any version of Python, past, present or future. Assigning to a literal
1 = ...
makes no sense and produces a syntax error. That's the only result you
could have gotten. If you think that's what you've done, then by all
means post a screen-shot showing is how you came to that conclusion, and
we'll correct you again. But I'll guarantee with absolute certainty,
that your posted Python program did not *run* "correctly" or incorrectly.
People on the group are willing to help with nearly anything, but it's
all a volunteer effort. You waste our time (either carelessly or
maliciously) if you don't accurately post your code and the results of
running that code.
So please try again. You *will* get help. There are a number of other
errors in your program also. We can get to those once we know what code
you are really running, and are sure that you know what it means to
*run* it, and that you can correctly identify the results -- error or not.
Gary Herron
[toc] | [prev] | [next] | [standalone]
| From | David Hutto <dwightdhutto@gmail.com> |
|---|---|
| Date | 2014-02-04 07:43 -0800 |
| Message-ID | <ed1c2ddd-f704-4d58-a5a4-aef13de88817@googlegroups.com> |
| In reply to | #65285 |
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@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@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
>>>
[toc] | [prev] | [next] | [standalone]
| From | David Hutto <dwightdhutto@gmail.com> |
|---|---|
| Date | 2014-02-04 10:54 -0500 |
| Message-ID | <mailman.6392.1391529261.18130.python-list@python.org> |
| In reply to | #65431 |
[Multipart message — attachments visible in raw view] — view raw
Missed that it's already pointed out, was looking at the google groups
combined email.
On Tue, Feb 4, 2014 at 10:43 AM, David Hutto <dwightdhutto@gmail.com> wrote:
> 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@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@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
> >>>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com <http://www.hitwebdevelopment.com>*
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-02-04 19:53 -0500 |
| Message-ID | <roy-4910C7.19535204022014@news.panix.com> |
| In reply to | #65431 |
In article <ed1c2ddd-f704-4d58-a5a4-aef13de88817@googlegroups.com>, David Hutto <dwightdhutto@gmail.com> wrote: > Can anyone point out how using an int as a var is possible one = 42 (ducking and running)
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-02-05 12:09 +1100 |
| Message-ID | <mailman.6415.1391562558.18130.python-list@python.org> |
| In reply to | #65463 |
On Wed, Feb 5, 2014 at 11:53 AM, Roy Smith <roy@panix.com> wrote: > In article <ed1c2ddd-f704-4d58-a5a4-aef13de88817@googlegroups.com>, > David Hutto <dwightdhutto@gmail.com> wrote: > >> Can anyone point out how using an int as a var is possible > > one = 42 > > (ducking and running) In theory, there might be a Unicode character that's valid as an identifier, but gets converted into U+0031 for ASCIIfication prior to being sent by email. However, I can't find one :) And of course, that assumes that the OP's mail client mangles its input in that way. ASCIIfication shouldn't be necessary. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Dan Sommers <dan@tombstonezero.net> |
|---|---|
| Date | 2014-02-05 02:22 +0000 |
| Message-ID | <lcs79s$98d$1@dont-email.me> |
| In reply to | #65463 |
On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: > In article <ed1c2ddd-f704-4d58-a5a4-aef13de88817@googlegroups.com>, > David Hutto <dwightdhutto@gmail.com> wrote: > >> Can anyone point out how using an int as a var is possible > > one = 42 > > (ducking and running) int = 42 (ducking lower and running faster)
[toc] | [prev] | [next] | [standalone]
| From | Joshua Landau <joshua@landau.ws> |
|---|---|
| Date | 2014-02-05 18:03 +0000 |
| Message-ID | <mailman.6424.1391623453.18130.python-list@python.org> |
| In reply to | #65466 |
[Multipart message — attachments visible in raw view] — view raw
On 5 February 2014 02:22, Dan Sommers <dan@tombstonezero.net> wrote: > On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: > > > In article <ed1c2ddd-f704-4d58-a5a4-aef13de88817@googlegroups.com>, > > David Hutto <dwightdhutto@gmail.com> wrote: > > > >> Can anyone point out how using an int as a var is possible > > > > one = 42 > > > > (ducking and running) > > int = 42 > > (ducking lower and running faster) globals()["1"] = 42 (limbo, limbo, limbo like me)
[toc] | [prev] | [next] | [standalone]
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2014-02-05 19:15 +0100 |
| Message-ID | <mailman.6425.1391624165.18130.python-list@python.org> |
| In reply to | #65466 |
Joshua Landau wrote: > On 5 February 2014 02:22, Dan Sommers <dan@tombstonezero.net> wrote: > >> On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: >> >> > In article <ed1c2ddd-f704-4d58-a5a4-aef13de88817@googlegroups.com>, >> > David Hutto <dwightdhutto@gmail.com> wrote: >> > >> >> Can anyone point out how using an int as a var is possible >> > >> > one = 42 >> > >> > (ducking and running) >> >> int = 42 >> >> (ducking lower and running faster) > > > globals()["1"] = 42 > > (limbo, limbo, limbo like me) >>> import sys, ctypes >>> ctypes.memmove(id(42), id(1), sys.getsizeof(42)) 37657512 >>> 42 1 Hm...
[toc] | [prev] | [next] | [standalone]
| From | "Mario R. Osorio" <nimbiotics@gmail.com> |
|---|---|
| Date | 2014-02-04 14:55 -0800 |
| Message-ID | <1df475a5-3125-48e0-8c12-7629dd9c0a06@googlegroups.com> |
| In reply to | #65285 |
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()
I don't know why people bother trying to help you, when it is YOU that has a ******* rude attitude.
You are asking the wrong question to begin with because the posted code could have NEVER given you the stated output.
Most of us here are noobs and those that are not, were noobs once; so we all can deal with noobs, but none should have to deal with a*******holes.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web