[Tutor] factorial of anumber

2012-02-04 Thread Debashish Saha
*PROGRAM TO FIND FACTORIAL OF A NUMBER(I HAVE WRITTEN IT ON GEDIT)* x=1 n=input('enter a positive integer no:') for i in range(1,1+n): x=x*i print x *ERROR:* enter a positive integer no:--- EOFError

Re: [Tutor] Importing libraries

2012-02-04 Thread Blockheads Oi Oi
On 04/02/2012 05:37, Michael Lewis wrote: Why don't I have to import str or list to access their attributes like I do with the math or random or any other library? -- Michael J. Lewis mjole...@gmail.com 415.815.7257 ___ T

Re: [Tutor] factorial of anumber

2012-02-04 Thread Blockheads Oi Oi
On 04/02/2012 10:11, Debashish Saha wrote: _PROGRAM TO FIND FACTORIAL OF A NUMBER(I HAVE WRITTEN IT ON GEDIT)_ x=1 n=input('enter a positive integer no:') for i in range(1,1+n): x=x*i print x _ERROR:_ enter a positive integer no:

Re: [Tutor] Importing libraries

2012-02-04 Thread Steven D'Aprano
Michael Lewis wrote: Why don't I have to import str or list to access their attributes like I do with the math or random or any other library? Because they are built-in. That means they live inside the Python compiler/interpreter itself. They are built-in because str, list, etc. are fundame

[Tutor] (no subject)

2012-02-04 Thread Debashish Saha
*input:* import numpy as np def f(y): return (y/5)*2*(np.pi)*0.2 *results:* f(11) Out[109]: 2.5132741228718345 f(11.0) Out[110]: 2.7646015351590183 *question:* why did i get different values for the same input? ___ Tutor maillist - Tutor@python.

Re: [Tutor] SEE THE QUESTION AT THE BOTTOM

2012-02-04 Thread Steven D'Aprano
Debashish Saha wrote: INPUT: *for n in range(2, 1000):* *for x in range(2, n):* *if n % x == 0:* Please don't add junk characters to your code. There is no need to add asterisks to each line, we can recognise Python code when we see it. Your code cannot run because of the ju

Re: [Tutor] (no subject)

2012-02-04 Thread Steven D'Aprano
Debashish Saha wrote: [...] why did i get different values for the same input? Please choose a sensible subject line when posting. The problem is with the division. Watch: py> 21/2 10 py> 21.0/2 10.5 By default, division in Python 2 is integer division: any remainder is ignored. To use f

Re: [Tutor] factorial of anumber

2012-02-04 Thread Steven D'Aprano
Debashish Saha wrote: *PROGRAM TO FIND FACTORIAL OF A NUMBER(I HAVE WRITTEN IT ON GEDIT)* This program is irrelevant. Your question has nothing to do with factorial of numbers. It is about getting input from the user. As you ask: HOW TO ASK INPUT FROM USER THEN? The answer is: Do not use

[Tutor] Urgent Help Required

2012-02-04 Thread Zafrullah Syed
Hi, I need urgent help: I am unable to commit code to svn, I am getting this warning: *svn: Commit failed (details follow):* *svn: Commit blocked by pre-commit hook (exit code 1) with output:* *:17: Warning: 'with' will become a reserved keyword in Python 2.6* *writeConf.py:17: invalid syntax* *

Re: [Tutor] factorial of anumber

2012-02-04 Thread bob gailer
I for one prefer plain text rather than HTML for email. Please in the future post plain text. No colors, no unusual fonts. Makes it a LOT easier to read. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] Tutor Digest, Vol 96, Issue 8

2012-02-04 Thread Zafrullah Syed
fname > --> 168 exec compile(scripttext, filename, 'exec') in glob, loc >169 else: >170 def execfile(fname, *where): > > C:\Users\as\mnb.py in () > 1 x=1 > > 2 n=input('enter a positive integer no:') > 3

Re: [Tutor] (no subject)

2012-02-04 Thread Alan Gauld
On 04/02/12 12:08, Debashish Saha wrote: f(11) Out[109]: 2.5132741228718345 f(11.0) Out[110]: 2.7646015351590183 *question:* why did i get different values for the same input? Because they are not the same inputs. 11 is an integer and 11.0 is a float and Python (along with many programming

Re: [Tutor] Urgent Help Required

2012-02-04 Thread Dave Angel
On 02/04/2012 08:17 AM, Zafrullah Syed wrote: Hi, I need urgent help: I am unable to commit code to svn, I am getting this warning: *svn: Commit failed (details follow):* *svn: Commit blocked by pre-commit hook (exit code 1) with output:* *:17: Warning: 'with' will become a reserved keyword in

Re: [Tutor] Tutor Digest, Vol 96, Issue 8

2012-02-04 Thread col speed
On 4 February 2012 20:29, Zafrullah Syed wrote: > Hi, > > I need urgent help: Yes, I think you do. Take notice of the last replies. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/list

Re: [Tutor] Tutor Digest, Vol 96, Issue 8

2012-02-04 Thread Dave Angel
On 02/04/2012 08:29 AM, Zafrullah Syed wrote: Hi, I need urgent help: I am unable to commit code to svn, I am getting this warning: *svn: Commit failed (details follow):* *svn: Commit blocked by pre-commit hook (exit code 1) with output:* *:17: Warning: 'with' will become a reserved keyword in

[Tutor] Failing svn pre-commit hok was Re: Urgent Help Required

2012-02-04 Thread Peter Otten
Zafrullah Syed wrote: > I need urgent help: Remember that this isn't paid support. Don't frivolously consume the goodwill of volunteers. > I am unable to commit code to svn, I am getting this warning: > > *svn: Commit failed (details follow):* > *svn: Commit blocked by pre-commit hook (exit co

Re: [Tutor] Tutor Digest, Vol 96, Issue 8

2012-02-04 Thread Alan Gauld
On 04/02/12 13:29, Zafrullah Syed wrote: I need urgent help: Then you are going a very bad way of getting it. If you must post for help a) pick a forum that ir related to your problem. This is a python beginners mailing list not an svn problem list. b) Follow the rules of the forum you are u

[Tutor] Return T/F vs print T/F

2012-02-04 Thread Sivaram Neelakantan
While trying out code, I have trouble following the difference between return True vs print True and the same with False. If I use return for the True/False statements, nothing gets printed. Why? And if I add a print before the function call I get an output like >>>True None --8<---

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread bob gailer
On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote: While trying out code, I have trouble following the difference between return True vs print True and the same with False. If I use return for the True/False statements, nothing gets printed. Why? Why did you expect something to be printed? Per

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Sivaram Neelakantan
On Sat, Feb 04 2012,bob gailer wrote: > On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote: >> While trying out code, I have trouble following the difference between >> >> return True vs print True and the same with False. If I use return >> for the True/False statements, nothing gets printed. Why?

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Steven D'Aprano
Sivaram Neelakantan wrote: While trying out code, I have trouble following the difference between return True vs print True and the same with False. If I use return for the True/False statements, nothing gets printed. Why? Probably because you aren't printing anything. Python can't read your

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Steven D'Aprano
Sivaram Neelakantan wrote: def palin(text): if first(text) == last(text): # print first(text), last(text), middle(text), len(middle(text)) if len(middle(text)) == 0: print True else: palin(middle(text)) else: print False Every br

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread Brett Ritter
On Sat, Feb 4, 2012 at 11:42 AM, Sivaram Neelakantan wrote: > On Sat, Feb 04 2012,bob gailer wrote: > >> On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote: >>> While trying out code, I have trouble following the difference between >>> >>> return True vs print True and the same with False.  If I use r

Re: [Tutor] Return T/F vs print T/F

2012-02-04 Thread bob gailer
On 2/4/2012 11:53 AM, Steven D'Aprano wrote: [snip] In the interactive interpreter, as a convenience, the result of each line is automatically printed for you: Actually the interpreter prints the result of each /statement /that IS an /expression/. >>> 2 2 >>> a = 3 >>> a 3 IOW if the line i

Re: [Tutor] Importing libraries

2012-02-04 Thread Devin Jeanpierre
On Sat, Feb 4, 2012 at 6:35 AM, Steven D'Aprano wrote: > Michael Lewis wrote: >> >> Why don't I have to import str or list to access their attributes like I >> do >> with the math or random or any other library? > > > > Because they are built-in. That means they live inside the Python > compiler/i

[Tutor] Pizza panic game

2012-02-04 Thread myles broomes
Im currently using a book called 'Programming in Python for the complete beginner' and at the end of each chapter, the reader is given challenges to do. The current chapter im on, one of the challenges is to take the source code for a 'Pizza Panic' game , and find a way to make the game more di

Re: [Tutor] Pizza panic game

2012-02-04 Thread Alan Gauld
On 04/02/12 23:43, myles broomes wrote: game comes up with an error and claims that the Spikey_ball object has no handle_caught attribute, but as you can see, it clearly does. Can anyone explain this to me? Please post the entire error message, do not summarize. There is often important inform

Re: [Tutor] Pizza panic game

2012-02-04 Thread Dave Angel
On 02/04/2012 06:43 PM, myles broomes wrote: Im currently using a book called 'Programming in Python for the complete beginner' and at the end of each chapter, the reader is given challenges to do. The current chapter im on, one of the challenges is to take the source code for a 'Pizza Panic'