Re: [Tutor] PYTHON 3.1

2010-05-27 Thread Dipo Elegbede
Sir,

Under the handling files topic, trying to compile the addressbook
example you gave,
am I to put them all in one file and save as address book? or each is
a different module
is saved in different files?

I have attached for your correction what I did, please let me know if
it is wrong and
then point out my mistakes.

I'll have a look at that topic again and make sure I fix
whatever correction you point out for me.

Thank You.



On 5/25/10, ALAN GAULD alan.ga...@btinternet.com wrote:
 OK, That means Python has not set up your PATH environment variable.
 This seems to be a common problem in recent releases, I think it is a
 bug but the Pyton developers disagree! :-)

 You need to follow the instructions in the box in the Getting Started topic.

 The test of whether it works is to go to the folder with your scripts in
 and just type python at the prompt. The usual  prompt should appear.

 As to your attachment here are some explanations:

 C:\Documents and Settings\Administratorcd\C:\Python31\Project
 The filename, directory name, or volume label syntax is incorrect.

 You put the \ in front of the drive again.
 Also please type a space between the cd and the path, it makes
 it much easier to read!
 ie:
 cd C:\Python31\Project

 C:\Documents and Settings\Administratorcd\Python31\Project

 This worked because the folder is on the same drive as the prompt, ie C.

 C:\Python31\Projectvar.py
 Access is denied.

 This is odd. Can you try two things:

 1) type dir var.*   (dir for *dir*ectory listing)
 2) assuming var.py is listed type attrib var.py

 Let me know what it says.

 C:\Python31\Projectpython var.py
 'python' is not recognized as an internal or external command,
 operable program or batch file.

 This should have worked if the PATH environment was set up properly...

 C:\Python31\Projecttestingformat
 Access is denied.

 You need to specify the .py because Windows uses that to know
 what program to use to execute the file - if its been set up properly!

 C:\Python31\Projectpython testingformat
 'python' is not recognized as an internal or external command,
 operable program or batch file.

 Again, even if PATH is fixed you would still neeed the .py extension

 C:\Python31\Projectcd\python31

 C:\Python31python var.py
 this is a string.this string continues here.

 This worked so var.py is in your python31 folder Is there also
 a copy in the Projects folder?

 You should move your Projects folder somewhere else though.
 Because if you uninstall python 3.1 - for example when
 version 3.2 comes out - the uninstaller will delete python31
 and everything under it - including your code!

 Alan Gauld
 Author of the Learn To Program website
 http://www.alan-g.me.uk/





 
 From: Dipo Elegbede delegb...@dudupay.com
 To: ALAN GAULD alan.ga...@btinternet.com
 Sent: Tuesday, 25 May, 2010 9:06:39
 Subject: Re: PYTHON 3.1

 got back to what you adviced Sir.
 I did the cd to the file where the codes were saved and typed
 pythonthe code but it replied python wasnot recognised.
 I have attached the screen of the command prompt for you to see what i mean.
 Thanks for your time.

 On 5/24/10, Dipo Elegbede delegb...@dudupay.com wrote:
 I'll see to that again and do exactly as you have directed.
 Thanks and best regards,


 On 5/24/10, ALAN GAULD alan.ga...@btinternet.com wrote:
 OK, See my other email.
 You should keep your code files in a completely separate
 folder from Python so that if you ever upgrade Python
 you don't lose all your code!

 The trick is to CD into the folder you store your code
 not the folder where Python lives.

  Alan Gauld
 Author of the Learn To Program website
 http://www.alan-g.me.uk/





 
 From: Dipo Elegbede delegb...@dudupay.com
 To: ALAN GAULD alan.ga...@btinternet.com
 Sent: Monday, 24 May, 2010 14:48:32
 Subject: Re: PYTHON 3.1

 Sir, I got it now.
 I moved all my codes to the python directory. I initially had another
 folder in the Python31 folder but now moved all to the Python31 folder
 and it's running well on the command prompt.
 Thanks.
 I'll go ahead to read stdin and stdout again and see what I can make of
 it.
 Regards,

 On 5/24/10, Dipo Elegbede delegb...@dudupay.com wrote:
 i have tried all that you advised, i still didn't run from the command
 prompt.

 Pls find attached the screen shot for various attempts I made.

 thanks.

 On 5/21/10, ALAN GAULD alan.ga...@btinternet.com wrote:
 I suspect the likely cause is that you need to change directory to the
 directory(folder) where your code lives. Lets say you keep your code
 in C:\Projects\Python

 start the DOS box
 Type (the bits in bold):

 C\:..\ cd C:\Projects\Python

 Now type

 C:\Projects\Pythonpython myprogram.py

 using whatever your python file is called...

 Now, provided everything is set up properly it should run.
 In fact you might even get away wioth jusdt typing:

 C:\Projects\Python\ myprogram.py

 Because in theory Windows should 

Re: [Tutor] PYTHON 3.1

2010-05-27 Thread wesley chun
greetings and welcome (back) to Python! i have a few comments for you:

1. The syntax for Python 3.x has changed from 2.x, so please be aware
of the differences as you are learning. Most books and code out there
is still 2.x. 3.x is being adopted but because of the differences, it
is slower than most version upgrades. also, 2.x is still going to be
current for awhile... it has not been obsoleted yet.

2. Are you in Nigeria? if so, you may wish to attend the Nigerian stop
of the Python Africa Tour:
http://www.coactivate.org/projects/python-african-tour/blog/2010/04/26/preparing-our-3rd-stop-nigeria/

3. Absolute Beginner CD: you asked for it last year --
http://www.nairaland.com/nigeria/topic-176782.64.html#msg3450555 --
but i guess no one has sent one to you yet? anyway, that edition is
only for Python 2. there is now a 3rd edition that is in Python 3. you
should be able to order it from your local technical bookstore, or you
can buy it from Amazon... they ship to Africa. here is the link to the
new edition: http://amazon.com/dp/1435455002

4. Put your reply to my email on the bottom and not on the top. I know
it's not easy because you  are on a mobile, but it makes things easier
to read. Yes, it is the opposite way of doing it from regular business
email.

best regards,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Core Python Programming, Prentice Hall, (c)2007,2001
Python Fundamentals, Prentice Hall, (c)2009
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-24 Thread Dipo Elegbede
Hello Sir,

I'm trying to write a program that checks for the square root of any
number input by the User.
It's a fairly simple coding though atleast for an ambitious beginner.

I want the code to first, calculate the square root and the tell the
user whether or not.

It should end up telling the User that this is a perfect square.

Below is the coding:

print('Check for a perfect square')
number = int(input('Which number are you checking for? '))
square = (number)**(1/2.0)
print('Square Root is = %.2f'%(square))

I am trying to put in something like:

if square (is perfect square):
print ('This is a perfect square')

Pls Help.

Thanks.


On 5/21/10, ALAN GAULD alan.ga...@btinternet.com wrote:
 I suspect the likely cause is that you need to change directory to the
 directory(folder) where your code lives. Lets say you keep your code
 in C:\Projects\Python

 start the DOS box
 Type (the bits in bold):

 C\:..\ cd C:\Projects\Python

 Now type

 C:\Projects\Pythonpython myprogram.py

 using whatever your python file is called...

 Now, provided everything is set up properly it should run.
 In fact you might even get away wioth jusdt typing:

 C:\Projects\Python\ myprogram.py

 Because in theory Windows should know to run python
 for a .py file But it often forgets :-(


  Alan Gauld
 Author of the Learn To Program website
 http://www.alan-g.me.uk/





 
 From: Dipo Elegbede delegb...@dudupay.com
 To: ALAN GAULD alan.ga...@btinternet.com
 Sent: Friday, 21 May, 2010 19:35:57
 Subject: Re: PYTHON 3.1

 I still can not successfully run Python from the windows command
 prompt after doing all you've directed in the tutorials. (Pls note,
 I'm not ruling out the probability that I didn't get the instructions
 right. As a matter of fact, this is possibly why I still have the
 problem.)
 Sir, I'm hoping you could take me through that again.
 Like when I type
 C:document and settingpython xx.py
 It tells me the file does not exit.
 It atimes starts python when I type python at the prompt to give:
 C:Python
 When i type the name of the file at the python prompt, I still get an
 error.e.g
 Pythonread.py
 It comes with error.
 It's challenging because some examples in your tutorial require I run
 from the prompt and so I'm getting stucked midway.
 Please Help.
 Regards,

 On 5/21/10, Dipo Elegbede delegb...@dudupay.com wrote:
 Hi Alan Sir,

 I have been reading through your site and the tutorials, it's just
 something else, I started feeling like a real programmer when i worked
 through the easygui thingy, it was really a mind-blower.
 I hope you'll pardon my pace of learning. I still didn't get some
 aspect under 'Conversing with the user'
 i really read through and I am hoping to reread but I would like you
 shed more light on the stdin and stdout areas.
 They are really confusing.
 Please help.
 Regards,

 On 5/20/10, Dipo Elegbede delegb...@dudupay.com wrote:
 Ok, Master. I should would have a lot to learn from you.

 I hope you'd oblige me that rare priviledge.

 Regards, Master!

 On 5/20/10, ALAN GAULD alan.ga...@btinternet.com wrote:


 I may consider pascal after excelling in Python.

 I wouldn't bother, the only place it is used nowadays is in the
 Borland Delphi programming tool for Windows(*). Delphi is very
 good if you already know Pascal but otherwise is just another
 language to learn! :-)

 (*)Although there is a freeware version of Pascal - fpc - that is
 compatible with Delphi if you really want to try it out. But
 definitely wait till after Python. (Actually Python is a good
 intro to Delphi, they have many features in common)

 Alan G.


 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise
 Application Development



 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise
 Application Development


 --
 Sent from my mobile device

 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise
 Application Development



-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-24 Thread Matthew Wood
Well, I'd use the raw_input function instead of the input function.

and I'd check out the math.floor function as well.  :-)

Lemme know if you have any other questions.

--

I enjoy haiku
but sometimes they don't make sense;
refrigerator?


On Mon, May 24, 2010 at 1:55 AM, Dipo Elegbede delegb...@dudupay.comwrote:

 Hello Sir,

 I'm trying to write a program that checks for the square root of any
 number input by the User.
 It's a fairly simple coding though atleast for an ambitious beginner.

 I want the code to first, calculate the square root and the tell the
 user whether or not.

 It should end up telling the User that this is a perfect square.

 Below is the coding:

 print('Check for a perfect square')
 number = int(input('Which number are you checking for? '))
 square = (number)**(1/2.0)
 print('Square Root is = %.2f'%(square))

 I am trying to put in something like:

 if square (is perfect square):
 print ('This is a perfect square')

 Pls Help.

 Thanks.


 On 5/21/10, ALAN GAULD alan.ga...@btinternet.com wrote:
  I suspect the likely cause is that you need to change directory to the
  directory(folder) where your code lives. Lets say you keep your code
  in C:\Projects\Python
 
  start the DOS box
  Type (the bits in bold):
 
  C\:..\ cd C:\Projects\Python
 
  Now type
 
  C:\Projects\Pythonpython myprogram.py
 
  using whatever your python file is called...
 
  Now, provided everything is set up properly it should run.
  In fact you might even get away wioth jusdt typing:
 
  C:\Projects\Python\ myprogram.py
 
  Because in theory Windows should know to run python
  for a .py file But it often forgets :-(
 
 
   Alan Gauld
  Author of the Learn To Program website
  http://www.alan-g.me.uk/
 
 
 
 
 
  
  From: Dipo Elegbede delegb...@dudupay.com
  To: ALAN GAULD alan.ga...@btinternet.com
  Sent: Friday, 21 May, 2010 19:35:57
  Subject: Re: PYTHON 3.1
 
  I still can not successfully run Python from the windows command
  prompt after doing all you've directed in the tutorials. (Pls note,
  I'm not ruling out the probability that I didn't get the instructions
  right. As a matter of fact, this is possibly why I still have the
  problem.)
  Sir, I'm hoping you could take me through that again.
  Like when I type
  C:document and settingpython xx.py
  It tells me the file does not exit.
  It atimes starts python when I type python at the prompt to give:
  C:Python
  When i type the name of the file at the python prompt, I still get an
  error.e.g
  Pythonread.py
  It comes with error.
  It's challenging because some examples in your tutorial require I run
  from the prompt and so I'm getting stucked midway.
  Please Help.
  Regards,
 
  On 5/21/10, Dipo Elegbede delegb...@dudupay.com wrote:
  Hi Alan Sir,
 
  I have been reading through your site and the tutorials, it's just
  something else, I started feeling like a real programmer when i worked
  through the easygui thingy, it was really a mind-blower.
  I hope you'll pardon my pace of learning. I still didn't get some
  aspect under 'Conversing with the user'
  i really read through and I am hoping to reread but I would like you
  shed more light on the stdin and stdout areas.
  They are really confusing.
  Please help.
  Regards,
 
  On 5/20/10, Dipo Elegbede delegb...@dudupay.com wrote:
  Ok, Master. I should would have a lot to learn from you.
 
  I hope you'd oblige me that rare priviledge.
 
  Regards, Master!
 
  On 5/20/10, ALAN GAULD alan.ga...@btinternet.com wrote:
 
 
  I may consider pascal after excelling in Python.
 
  I wouldn't bother, the only place it is used nowadays is in the
  Borland Delphi programming tool for Windows(*). Delphi is very
  good if you already know Pascal but otherwise is just another
  language to learn! :-)
 
  (*)Although there is a freeware version of Pascal - fpc - that is
  compatible with Delphi if you really want to try it out. But
  definitely wait till after Python. (Actually Python is a good
  intro to Delphi, they have many features in common)
 
  Alan G.
 
 
  --
  Elegbede Muhammed Oladipupo
  OCA
  +2348077682428
  +2347042171716
  www.dudupay.com
  Mobile Banking Solutions | Transaction Processing | Enterprise
  Application Development
 
 
 
  --
  Elegbede Muhammed Oladipupo
  OCA
  +2348077682428
  +2347042171716
  www.dudupay.com
  Mobile Banking Solutions | Transaction Processing | Enterprise
  Application Development
 
 
  --
  Sent from my mobile device
 
  Elegbede Muhammed Oladipupo
  OCA
  +2348077682428
  +2347042171716
  www.dudupay.com
  Mobile Banking Solutions | Transaction Processing | Enterprise
  Application Development
 


 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise
 Application Development
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 

Re: [Tutor] PYTHON 3.1

2010-05-24 Thread ALAN GAULD

 Well, I'd use the raw_input function instead of the input function.

input is raw_input in Python 3.1.
raw_input doesn't exist.

Alan G.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-24 Thread C M Caine
On 24 May 2010 09:20, Matthew Wood woodm1...@gmail.com wrote:
 Well, I'd use the raw_input function instead of the input function.

 and I'd check out the math.floor function as well.  :-)

 Lemme know if you have any other questions.

 --

 I enjoy haiku
 but sometimes they don't make sense;
 refrigerator?

raw_input has been renamed to input in python 3.0. To get the old
input behaviour you have to use eval.

Great sig, btw.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-24 Thread Matthew Wood
Well, what do you know!

Turns out, I never use that function anyway, so it won't change a damn thing
for me.  But thanks for the heads up!


And thanks for the nod to the haiku.  So many people don't see it.

--

I enjoy haiku
but sometimes they don't make sense;
refrigerator?


On Mon, May 24, 2010 at 3:36 AM, C M Caine cmca...@googlemail.com wrote:

 On 24 May 2010 09:20, Matthew Wood woodm1...@gmail.com wrote:
  Well, I'd use the raw_input function instead of the input function.
 
  and I'd check out the math.floor function as well.  :-)
 
  Lemme know if you have any other questions.
 
  --
 
  I enjoy haiku
  but sometimes they don't make sense;
  refrigerator?

 raw_input has been renamed to input in python 3.0. To get the old
 input behaviour you have to use eval.

 Great sig, btw.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-19 Thread Dipo Elegbede
Thanks Alan, I'm on it.
Regards.

On 5/18/10, Alan Gauld alan.ga...@btinternet.com wrote:

 Dipo Elegbede delegb...@dudupay.com wrote

 please confirm this is a new syntax for print.
 thank you.

 i will put up morte concerns as they arrive.

 Please read the Whats New in Python v3 documents first.
 Version 3 of Python is a major change in the language with
 many big changes. Do not just try stuff and send it here
 every time something breaks.

 Read the documents first so you know what to expect.

 --
 Alan Gauld
 Author of the Learn to Program web site
 http://www.alan-g.me.uk

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-19 Thread Dipo Elegbede
Hi Alan.
I was looking through your page http://www.alan-g.me.uk/l2p/index.htm;
Covering the topic: Looping - Or the art of repeating oneself!
Under for loop, Note 3:
...*You can prove that by typing   print( list( range(1,13) )*..
The print statement above seem to be incomplete, I think a single
parenthesis is missing. it should be six in all.
Please confirm and effect the correction on the web page.
Thanks.

On 5/19/10, Dipo Elegbede delegb...@dudupay.com wrote:
 Thanks Alan, I'm on it.
 Regards.

 On 5/18/10, Alan Gauld alan.ga...@btinternet.com wrote:

 Dipo Elegbede delegb...@dudupay.com wrote

 please confirm this is a new syntax for print.
 thank you.

 i will put up morte concerns as they arrive.

 Please read the Whats New in Python v3 documents first.
 Version 3 of Python is a major change in the language with
 many big changes. Do not just try stuff and send it here
 every time something breaks.

 Read the documents first so you know what to expect.

 --
 Alan Gauld
 Author of the Learn to Program web site
 http://www.alan-g.me.uk

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise
 Application Development



-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PYTHON 3.1

2010-05-18 Thread Dipo Elegbede
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)]
on win32
Type copyright, credits or license() for more information.
 print 'hello'
SyntaxError: invalid syntax (pyshell#0, line 1)
 print ('hello')
hello


the above print is what i came across having installed python 3.0 and trying
to run the print command.
with previous versions, a print command takes the form
print 'parameter'
and the output is
parameter

but with this new version it seems you need to put in brackets like:
print ('hello')
to get an output like:
hello

please confirm this is a new syntax for print.
thank you.

i will put up morte concerns as they arrive.

thanks.
-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread James Reynolds
On Tue, May 18, 2010 at 8:40 AM, Dipo Elegbede delegb...@dudupay.comwrote:

 Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
 (Intel)] on win32
 Type copyright, credits or license() for more information.
  print 'hello'
 SyntaxError: invalid syntax (pyshell#0, line 1)
  print ('hello')
 hello
 

 the above print is what i came across having installed python 3.0 and
 trying to run the print command.
 with previous versions, a print command takes the form
 print 'parameter'
 and the output is
 parameter

 but with this new version it seems you need to put in brackets like:
 print ('hello')
 to get an output like:
 hello

 please confirm this is a new syntax for print.
 thank you.

 i will put up morte concerns as they arrive.

 thanks.
 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise Application
 Development

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



In python 3K print is a function.

So, print('hello, world') is the correct syntax.

You may find this article helpful:
http://docs.python.org/py3k/whatsnew/3.0.html
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Christian Witts

Dipo Elegbede wrote:
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit 
(Intel)] on win32

Type copyright, credits or license() for more information.
 print 'hello'
SyntaxError: invalid syntax (pyshell#0, line 1)
 print ('hello')
hello


the above print is what i came across having installed python 3.0 and 
trying to run the print command.

with previous versions, a print command takes the form
print 'parameter'
and the output is
parameter

but with this new version it seems you need to put in brackets like:
print ('hello')
to get an output like:
hello

please confirm this is a new syntax for print.
thank you.

i will put up morte concerns as they arrive.

thanks.
--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com http://www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise 
Application Development



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
  

The Python 3.x series changed the print statement to a print function.

--
Kind Regards,
Christian Witts


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Dipo Elegbede
thanks a lot.

i was almost going to abandon this python again out of frustration. i have
done it before but with you guys around, it would never happen again.

i have a pdf version of python programming for absolute beginners, could
anyone please help me with its accompaning CD content?

thanks as i anticipate responses.

regards.
On Tue, May 18, 2010 at 2:02 PM, James Reynolds eire1...@gmail.com wrote:



 On Tue, May 18, 2010 at 8:40 AM, Dipo Elegbede delegb...@dudupay.comwrote:

 Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
 (Intel)] on win32
 Type copyright, credits or license() for more information.
  print 'hello'
 SyntaxError: invalid syntax (pyshell#0, line 1)
  print ('hello')
 hello
 

 the above print is what i came across having installed python 3.0 and
 trying to run the print command.
 with previous versions, a print command takes the form
 print 'parameter'
 and the output is
 parameter

 but with this new version it seems you need to put in brackets like:
 print ('hello')
 to get an output like:
 hello

 please confirm this is a new syntax for print.
 thank you.

 i will put up morte concerns as they arrive.

 thanks.
 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise Application
 Development

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



 In python 3K print is a function.

 So, print('hello, world') is the correct syntax.

 You may find this article helpful:
 http://docs.python.org/py3k/whatsnew/3.0.html


 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Dave Angel
(Please don't top-post.  Add your comments to the end of the portion 
you're quoting.)


Dipo Elegbede wrote:

thanks a lot.

i was almost going to abandon this python again out of frustration. i have
done it before but with you guys around, it would never happen again.

i have a pdf version of python programming for absolute beginners, could
anyone please help me with its accompaning CD content?

thanks as i anticipate responses.

regards.
  
  

I don't know the version that your CD was written for.

If you're going to use a tutorial, it's smart to get a matching version 
of Python.  So if your tutorial is for 2.x, you should get Python 2.6 
(or soon, 2.7).  Otherwise, you'll be frequently frustrated by the 
differences.


They're not that bad, once you know the language.  But while you're 
learning, try to match your learning materials with your version.


DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Dipo Elegbede
I AM CURRENTLY LEARNING WITH PYTHON 3.0
just about now, you are all blowing my minds.
this is great.

On Tue, May 18, 2010 at 2:49 PM, Dave Angel da...@ieee.org wrote:

 (Please don't top-post.  Add your comments to the end of the portion you're
 quoting.)


 Dipo Elegbede wrote:

 thanks a lot.

 i was almost going to abandon this python again out of frustration. i have
 done it before but with you guys around, it would never happen again.

 i have a pdf version of python programming for absolute beginners, could
 anyone please help me with its accompaning CD content?

 thanks as i anticipate responses.

 regards.


 I don't know the version that your CD was written for.

 If you're going to use a tutorial, it's smart to get a matching version of
 Python.  So if your tutorial is for 2.x, you should get Python 2.6 (or soon,
 2.7).  Otherwise, you'll be frequently frustrated by the differences.

 They're not that bad, once you know the language.  But while you're
 learning, try to match your learning materials with your version.

 DaveA




-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Dipo Elegbede
That's a good one Sir, i started out with 2.x series but left it for a
while.
Coming back now, i'm getting on well just for this few changes but I think
with a forum like this, I'd fare well in this pythonic journey.
Thanks.

On Tue, May 18, 2010 at 2:56 PM, Walter Prins wpr...@gmail.com wrote:

 IMHO: If you're new to Python and just trying to learn the language, I'd
 suggest sticking to Python 2.x for now, as the vast majority of Python
 material out there still use and refer to Python 2.x syntax.   IMHO it'll be
 a lot easier learning and coping with what's changed in Python 3 only once
 you are already comfortable with Python 2.x syntax, rather than trying to
 use materials and books referencing 2.x on 3.x and then consequently running
 into unexpected issues as above, and never being sure whether issues you run
 into is due to some mistake on your part or a difference between 2.x and
 3.x.




-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread spir ☣
On Tue, 18 May 2010 14:53:45 +0100
Dipo Elegbede delegb...@dudupay.com wrote:

 I AM CURRENTLY LEARNING WITH PYTHON 3.0
 just about now, you are all blowing my minds.
 this is great.

Please don't write your replies on top. Write them instead just after the 
part(s) of the message you're replying to; and delete the rest. By doing so, 
you help keeping the flow of the discussion; else, everything gets messed up 
after 2-3 replies.

Denis


vit esse estrany ☣

spir.wikidot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Alan Gauld


Dipo Elegbede delegb...@dudupay.com wrote 


please confirm this is a new syntax for print.
thank you.

i will put up morte concerns as they arrive.


Please read the Whats New in Python v3 documents first.
Version 3 of Python is a major change in the language with 
many big changes. Do not just try stuff and send it here 
every time something breaks. 


Read the documents first so you know what to expect.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PYTHON 3.1

2010-05-18 Thread Dipo Elegbede
ok

On 5/18/10, spir ☣ denis.s...@gmail.com wrote:
 On Tue, 18 May 2010 14:53:45 +0100
 Dipo Elegbede delegb...@dudupay.com wrote:

 I AM CURRENTLY LEARNING WITH PYTHON 3.0
 just about now, you are all blowing my minds.
 this is great.

 Please don't write your replies on top. Write them instead just after the
 part(s) of the message you're replying to; and delete the rest. By doing so,
 you help keeping the flow of the discussion; else, everything gets messed up
 after 2-3 replies.

 Denis
 

 vit esse estrany ☣

 spir.wikidot.com
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python 3.1: How to print a very large number to n significant digits?

2009-11-23 Thread Richard D. Moores
Can't find the answer in the docs for 3.1

To print 123**34.6 to 5 sig digits,

print(%.*e % (4, 123**34.6))

will do the job:

 print(%.*e % (4, 123**34.6))
2.0451e+72

However, if the number is 123**346, using

print(%.*e % (4, 123**346))

gets me

 print(%.*e % (5, 123**346))
Traceback (most recent call last):
  File pyshell#28, line 1, in module
print(%.*e % (5, 123**346))
OverflowError: Python int too large to convert to C double

So how to do it?

Thanks,

Dick Moores
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python 3.1: How to print a very large number to n significant digits?

2009-11-23 Thread Wayne Werner
On Mon, Nov 23, 2009 at 12:28 PM, Richard D. Moores rdmoo...@gmail.comwrote:

 Can't find the answer in the docs for 3.1

 To print 123**34.6 to 5 sig digits,

 print(%.*e % (4, 123**34.6))

 will do the job:

  print(%.*e % (4, 123**34.6))
 2.0451e+72

 However, if the number is 123**346, using

 print(%.*e % (4, 123**346))

 gets me

  print(%.*e % (5, 123**346))
 Traceback (most recent call last):
  File pyshell#28, line 1, in module
print(%.*e % (5, 123**346))
 OverflowError: Python int too large to convert to C double


Try the decimal module:

http://docs.python.org/library/decimal.html

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python 3.1: How to print a very large number to n significant digits?

2009-11-23 Thread Richard D. Moores
On Mon, Nov 23, 2009 at 12:23, Wayne Werner waynejwer...@gmail.com wrote:
 On Mon, Nov 23, 2009 at 12:28 PM, Richard D. Moores rdmoo...@gmail.com
 wrote:

 Can't find the answer in the docs for 3.1

 To print 123**34.6 to 5 sig digits,

 print(%.*e % (4, 123**34.6))

 will do the job:

  print(%.*e % (4, 123**34.6))
 2.0451e+72

 However, if the number is 123**346, using

 print(%.*e % (4, 123**346))

 gets me

  print(%.*e % (5, 123**346))
 Traceback (most recent call last):
  File pyshell#28, line 1, in module
    print(%.*e % (5, 123**346))
 OverflowError: Python int too large to convert to C double

 Try the decimal module:
 http://docs.python.org/library/decimal.html
 HTH,
 Wayne

Yes, I just found this function in my collection of functions. I
believe I wrote this one myself, but I can't remember for sure:

===
def numberRounding(n, significantDigits):

Rounds a string in the form of a string number
(float or integer, negative or positive) to any number of
significant digits. If an integer, there is no limitation on it's size.
Safer to always have n be a string.

import decimal
def d(x):
return decimal.Decimal(str(x))
decimal.getcontext().prec = significantDigits
s = str(d(n)/1)
s = s.lstrip('0')
return s
===

 numberRounding(123**346,5)
'1.2799E+723'
 numberRounding(123**34.6,5)
'2.0451E+72'
 numberRounding(12345**6789,3)
'1.36E+2'
 numberRounding(3.4**-12.9,6)
'1.39291E-7'

Dick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor