[Tutor] While truth

2014-05-20 Thread Ian D
I was reading a tutorial that had these examples in it: >>> while False: print("False is the new True.") >>> while 6: print("Which numbers are True?") while -1: print("Which numbers are True?") while 0: print("Which numbers are True?") Unfortunately the author never explained

Re: [Tutor] While truth

2014-05-20 Thread Ian D
Or should I have said While False is True, which is never True, because False is False not True > From: dux...@hotmail.com > To: tutor@python.org > Date: Tue, 20 May 2014 08:25:48 + > Subject: [Tutor] While truth > > I was reading a tutorial that had t

Re: [Tutor] While truth

2014-05-20 Thread David Palao
Hi, 6, -1 or 0 are not bools (True or False): >>> 6 is True False >>> 0 is False False If you had to design a language and want to think about using numbers in a logical context you could do at least two things: 1) convert the number to bool, ie define a set of rules to assign to each number a lo

Re: [Tutor] While truth

2014-05-20 Thread Cameron Simpson
On 20May2014 08:25, Ian D wrote: I was reading a tutorial that had these examples in it: while False: print("False is the new True.") while 6: print("Which numbers are True?") while -1: print("Which numbers are True?") while 0: print("Which numbers are True?") Unfortunately the auth

[Tutor] Return Variable from Function.

2014-05-20 Thread rsm
Hello, (im using python 2.7) I've been having some problems to return the variable from a function so i decided to try to do it with with global variables, but the script is not working good. I've been reading tutorials but i just don't get how to do it and i would like to ask for some help >

Re: [Tutor] While truth

2014-05-20 Thread Steven D'Aprano
On Tue, May 20, 2014 at 08:25:48AM +, Ian D wrote: > I was reading a tutorial that had these examples in it: > > >>> while False: > > print("False is the new True.") [... snip examples ...] > I was wondering if the gist of a while statement could be explained in > the context of these

Re: [Tutor] Return Variable from Function.

2014-05-20 Thread Alan Gauld
On 20/05/14 13:33, rsm wrote: I've been having some problems to return the variable from a function so i decided to try to do it with with global variables, That's usually a bad idea. However, what you have not shown us is what you did try that didn't work. (Unless thats what the snippet belo

Re: [Tutor] Return Variable from Function.

2014-05-20 Thread ALAN GAULD
>Thanks so much for your answer Alan! it gave me something to work with :), unfortunately it stills not working :/ > >I've made several comments in the code...           >def prompt_desition(message, proceed_label, cancel_label,return_value): >    "Display a window with the selected messag

Re: [Tutor] While truth

2014-05-20 Thread Danny Yoo
On Tue, May 20, 2014 at 1:25 AM, Ian D wrote: > I was reading a tutorial that had these examples in it: > > while False: > print("False is the new True.") > > while 6: > print("Which numbers are True?") > > > while -1: > print("Which numbers are True?") > > > while 0: > print("Wh

Re: [Tutor] While truth

2014-05-20 Thread C Smith
You can test out a condition like this in IDLE like so: while 6: print "yes its true" break while 0: print "yes its true" break while -1: print "yes its true" break emptyList = [] while emtpyList: print "yes its true" break This way you don't have to deal with

Re: [Tutor] While truth

2014-05-20 Thread Danny Yoo
On Tue, May 20, 2014 at 11:44 AM, C Smith wrote: > You can test out a condition like this in IDLE like so: > while 6: > print "yes its true" > break > > > while 0: > print "yes its true" > break > > > while -1: > print "yes its true" > break > > > emptyList = [] > while emt

Re: [Tutor] While truth

2014-05-20 Thread C Smith
Of course that isn't very useful code. I thought it might be a useful quick test for someone learning how while loops treat different values. On Tue, May 20, 2014 at 2:46 PM, Danny Yoo wrote: > On Tue, May 20, 2014 at 11:44 AM, C Smith > wrote: >> You can test out a condition like this in IDLE

[Tutor] Main function

2014-05-20 Thread Wheeler, Gabriel
I am a beginner at python programming and right now we have to write the text to design a program that will make a histogram for Benford's law which says that in a natural set of data 1 will appear more than 2 which will appear more than 3 and so on. So given a set of data I want a list showing

Re: [Tutor] Main function

2014-05-20 Thread Danny Yoo
> Since I'm new to python and don't really know how to write programs yet, my > first question would be what exactly is the main function, because we did a > similar assignment before this one that included it, and I'm not sure what > exactly it does. When you write a program, you write a collect

[Tutor] How to create web interface?

2014-05-20 Thread P McCombs
On May 14, Danny Yoo wrote: > > Another option might be to turn your program into a web site, so that > > the interface is the web browser, which everyone is getting used to > > these days. But this, too, is also... involved. :P I have a little volunteer scheduling application I've written as a

Re: [Tutor] How to create web interface?

2014-05-20 Thread R. Alan Monroe
> I don't understand how precisely the web page would communicate with > the python program. In the simplest case, the webserver software executes your script. Whatever you print() _is_ the webpage. The webserver sends whatever you print() to the user's browser. http://en.wikipedia.org/wiki/Comm

Re: [Tutor] How to create web interface?

2014-05-20 Thread Danny Yoo
> I don't understand how precisely the web page would communicate with > the python program. Whenever you're communicating to a web site, you are contacting a live program, a "web server". In typical usage, a web server delivers static files from its file system. But it doesn't have to be that

Re: [Tutor] How to create web interface?

2014-05-20 Thread Walter Prins
Hi, On 20 May 2014 21:00, P McCombs wrote: > On May 14, Danny Yoo wrote: >> > Another option might be to turn your program into a web site, so that >> > the interface is the web browser, which everyone is getting used to >> > these days. But this, too, is also... involved. :P > > I have a littl

Re: [Tutor] How to create web interface?

2014-05-20 Thread Alan Gauld
On 20/05/14 21:00, P McCombs wrote: On May 14, Danny Yoo wrote: Another option might be to turn your program into a web site, so that the interface is the web browser, which everyone is getting used to these days. But this, too, is also... involved. :P I have a little volunteer scheduling ap

Re: [Tutor] How to create web interface?

2014-05-20 Thread P McCombs
Thank you all for your responses. This is exactly the information I was looking for. Paul McCombs On Tue, May 20, 2014 at 4:36 PM, Alan Gauld wrote: > On 20/05/14 21:00, P McCombs wrote: >> >> On May 14, Danny Yoo wrote: Another option might be to turn your program into a web site, so

[Tutor] Find Daily max - create lists using date and add hourly data to that list for the day

2014-05-20 Thread questions anon
I have hourly 2D temperature data in a monthly netcdf and I would like to find the daily maximum temperature. The shape of the netcdf is (744, 106, 193) I would like to use the year-month-day as a new list name (i.e. 2009-03-01, 2009-03-022009-03-31) and then add each of the hours worth of te