This is a GREAT application for generators!
def cycle(seq, index):
l = len(seq)
for i in range(len(seq)):
cursor = (i + index) % l
yield seq[cursor]
Then you just pass it the starting index you want, and all is well in the
world. :-)
Also, gratuitous use of the enumerate
Here is the code I am not sure why this is not working I have sessions
turned on.
import cherrypy
@cherrypy.expose
def security(f):
cherrypy.session.get('id')
return f
___
Tutor maillist - Tutor@python.org
To un
"Bala subramanian" wrote
But here the value of y changes sequentially. I want y to cycle
through the
list something like the following. Is there any function to do such
circular
iteration.
cycle 1 y's value should be 'N', 'L', 'C', 'M, 'R' index 1,2,3,4,0
of myres
cycle 2 y's value should
"Rayon" wrote
I am trying to get and set some session variables in ram with
cherrypy
Here is my code:
import cherrypy
#cherry.session.get('user')
#cherry.session.get('password')
You import cherrypy but you use cherry?
Should it maybe be:
cherrypy.session?
or maybe even
cherrypy.cherr
I am trying to get and set some session variables in ram with cherrypy
Here is my code:
import cherrypy
#cherry.session.get('user')
#cherry.session.get('password')
def security(f):
cherry.session.get('user')
cherry.session.get('password')
error messa
Friends,
I have a list. I have to do some comparison of each item in the list with
each other items in the list.
from numpy import zeros
a=zeros((5,5))
myres=['R', 'N', 'L', 'C', 'M']
DON=['R','N','L'] ; ALL=['R','L','M','S']
for x in myres:
for y in myres:
if x in DON:
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, 20
On 24 May 2010 09:20, Matthew Wood 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
> 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/mailm
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 wrote:
>
"patricia welch" wrote
here is what I need and I am completely stumped on what to do.
I'm not quite sure what you are asking us here?
This appears to be a homework excercise? If so the rules of
the list mean we won't give you an solution but we will try to
point you towards the answer.
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 U
here is what I need and I am completely stumped on what to do. I ususally do
not have a problem doing this. but this one is just killing me.
Programming a Personal Budget Program Write a program for a personal budget
that satisfies these conditions:
. The program should have the following comma
13 matches
Mail list logo