2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto:
> Hi, all
>
>
>
> I want to make the function use while statement,and without a deepcopy
> functions.
>
>
>
> this is my use deepcopy function correct codes, So, how can i to do a
> different way and use whil
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto:
> Hi, all
>
>
>
> I want to make the function use while statement,and without a deepcopy
> functions.
>
>
>
> this is my use deepcopy function correct codes, So, how can i to do a
> different way and use whil
Hi, all
I want to make the function use while statement,and without a deepcopy
functions.
this is my use deepcopy function correct codes, So, how can i to do a
different way and use while statement:
def foo(x):
if not isinstance(x, list):
return x
return [foo(y) for y in x
On 6/12/14 11:57 AM, Chris Angelico wrote:
def poplist(L):
done = False
while done==False:
yield L[::-1][:1:]
L = L[::-1][1::][::-1]
if len(L)==0: done=True
Why not just "while L"?
OK, here it is with Chris' excellent adv
On 6/12/14 11:57 AM, Chris Angelico wrote:
On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris wrote:
Consider this generator variation:
def poplist(L):
done = False
while done==False:
yield L[::-1][:1:]
L = L[::-1][1::][::-1]
On 6/12/14 11:55 AM, Marko Rauhamaa wrote:
while not done:
Better Python and not bad English, either.
... and taking Marko's good advice, what I think you really wanted:
>>> def poplist(L):
done = False
while not done:
yield L[::-1][:1:]
L
> while done==False:
Correction:
while not done:
Better Python and not bad English, either.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris wrote:
> Consider this generator variation:
>
def poplist(L):
> done = False
> while done==False:
>
> yield L[::-1][:1:]
> L = L[::-1][1::][::-1]
> if len(L)==0: done=True
Why not j
On 6/11/14 10:12 PM, hito koto wrote:
def foo(x):
y = []
while x !=[]:
y.append(x.pop())
return y
Consider this generator variation:
>>> def poplist(L):
done = False
while done==False:
yield L[::-1][:1:]
L = L[::-1][1::]
On 6/11/14 10:12 PM, hito koto wrote:
i want to change this is code:
def foo(x):
y = []
while x !=[]:
y.append(x.pop())
return y
Consider this generator (all kinds of permutations on the idea):
>>> L1
[1, 2, 3, 4, 5, 6, 7]
>>> def poplist(L):
while True:
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano:
> On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote:
>
>
>
> > I want to use while statement,
>
> >
>
> > for example:
>
> >>>> def foo(x):
>
> > ... y
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano:
> On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote:
>
>
>
> > I want to use while statement,
>
> >
>
> > for example:
>
> >>>> def foo(x):
>
> > ... y
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano:
> On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote:
>
>
>
> > I want to use while statement,
>
> >
>
> > for example:
>
> >>>> def foo(x):
>
> > ... y
On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote:
> I want to use while statement,
>
> for example:
>>>> def foo(x):
> ... y = []
> ... while x !=[]:
> ... y.append(x.pop())
> ... return y
> ...
>>>> print foo(a)
> [[10
On Thu, Jun 12, 2014 at 2:56 PM, hito koto wrote:
> I want to use while statement,
This sounds like homework. Go back to your teacher/tutor for
assistance, rather than asking us to do the work for you; or at very
least, word your question in such a way that we can help you to learn,
rather t
2014年6月12日木曜日 12時58分27秒 UTC+9 Chris Angelico:
> On Thu, Jun 12, 2014 at 1:40 PM, Vincent Vande Vyvre
>
> wrote:
>
> > Le 12/06/2014 05:12, hito koto a écrit :
>
> >
>
> >> Hello,all
>
> >> I'm first time,
>
> >>
>
On Thu, Jun 12, 2014 at 1:40 PM, Vincent Vande Vyvre
wrote:
> Le 12/06/2014 05:12, hito koto a écrit :
>
>> Hello,all
>> I'm first time,
>>
>> I want to make a while statement which can function the same x.pop () and
>> without the use of pop、how can i t
Le 12/06/2014 05:12, hito koto a écrit :
Hello,all
I'm first time,
I want to make a while statement which can function the same x.pop () and
without the use of pop、how can i to do?
i want to change this is code:
def foo(x):
y = []
while x !=[]:
y.append(
hito koto Wrote in message:
> Hello,all
> I'm first time,
>
> I want to make a while statement which can function the same x.pop () and
> without the use of pop、how can i to do?
No idea what the question means. Are you just trying to rewrite
the loop in a python impleme
Hello,all
I'm first time,
I want to make a while statement which can function the same x.pop () and
without the use of pop、how can i to do?
i want to change this is code:
def foo(x):
y = []
while x !=[]:
y.append(x.pop())
return y
--
https://mail.python.org/ma
15 print("counter: ", counter
16
17 while (end == 0): #
<---returns syntax error on this while statement
Among other responses, there is no indent after print.
should be
print()
while x:
On Fri, Jan 7, 2011 at 8:55 PM, Chris Rebert wrote:
> On Fri, Jan 7, 2011 at 9:46 PM, Garland Fulton
> wrote:
>
> > 1 #!/bin/bash/python
>
> > What is
> > wrong with my shebang line?
>
> Its path is invalid (unless you're using a *very* weird system).
> /bin/bash is the bash shell executable
On Fri, Jan 7, 2011 at 9:46 PM, Garland Fulton wrote:
> 1 #!/bin/bash/python
> What is
> wrong with my shebang line?
Its path is invalid (unless you're using a *very* weird system).
/bin/bash is the bash shell executable; bash is completely unrelated
to Python. Further, /bin/bash is a file, n
unt: ", count)
14 print("count1: ", count1)
15 print("counter: ", counter)
16
17 while end == 0: #
<---returns syntax error on this while statement
18 if(count < x):
19
20 sol = math.
In article
,
Garland Fulton wrote:
> I don't understand what I'm doing wrong i've tried several different cases
> for what i am doing here. Will someone please point my error out.
> 15 print("counter: ", counter
Missing ")" on line 15.
--
Ned Deily,
n...@acm.org
--
http://mail.p
x27;s the closing parenthesis?
> 17 while (end == 0): #
> <---returns syntax error on this while statement
Always include the exact error message + traceback in the future.
Cheers,
Chris
--
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list
print("counter: ", counter
16
17 while (end == 0): #
<---returns syntax error on this while statement
18 if(count < x):
19
20 sol = math.pow(count, 2) + math.pow(count1, 2)
On Fri, 22 May 2009 21:33:05 +1000
Joel Ross wrote:
> changed it to "float(number)/total*100" and it worked thanks for all
> your help appreciated
I believe operator.truediv function also deserves a mention here, since
line "op.truediv(number, total) * 100" somehow seem to make more sense
to me
On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote:
>
> Tim Wintle wrote:
> > On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
> >
> >> number/total = 998/999 = 0
> >> number/total*100 = 0*100 = 0
> >> float(number/total*100) = float(0) = 0.0
> >>
> >> Change "float(number/total*100)" to
On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote:
>
> Tim Wintle wrote:
> > On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
> >> Change "float(number/total*100)" to "float(number)/total*100" and it
> >> should work:
> >>
> >
> > I'd use:
> >
> > (number * 100.)/total
> >
> > - wor
Dave Angel wrote:
Tim Wintle wrote:
On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
number/total = 998/999 = 0
number/total*100 = 0*100 = 0
float(number/total*100) = float(0) = 0.0
Change "float(number/total*100)" to "float(number)/total*100" and it
should work:
I'd use:
(n
Tim Wintle wrote:
On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
number/total = 998/999 = 0
number/total*100 = 0*100 = 0
float(number/total*100) = float(0) = 0.0
Change "float(number/total*100)" to "float(number)/total*100" and it
should work:
I'd use:
(number * 100.)/tota
On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
> number/total = 998/999 = 0
> number/total*100 = 0*100 = 0
> float(number/total*100) = float(0) = 0.0
>
> Change "float(number/total*100)" to "float(number)/total*100" and it
> should work:
I'd use:
(number * 100.)/total
- works because
Andre Engels wrote:
On Fri, May 22, 2009 at 12:35 PM, Joel Ross wrote:
Im using 2.6 python and when running this
class progess():
def __init__(self, number, total, char):
percentage = float(number/total*100)
percentage = int(round(percentage))
char = char * percenta
On Fri, May 22, 2009 at 12:35 PM, Joel Ross wrote:
> Im using 2.6 python and when running this
>
> class progess():
>
> def __init__(self, number, total, char):
>
> percentage = float(number/total*100)
> percentage = int(round(percentage))
> char = char * percentage
>
> Im using 2.6 python and when running this
>
> class progess():
>
> def __init__(self, number, total, char):
>
> percentage = float(number/total*100)
> percentage = int(round(percentage))
> char = char * percentage
> print char
>
> progess(1
Andre Engels wrote:
On Fri, May 22, 2009 at 11:17 AM, Joel Ross wrote:
Hi all,
I have this piece of code
class progess():
def __init__(self, number, char):
total = number
percentage = number
while percentage > 0 :
percentage = int(number/total*100)
Joel Ross wrote:
Hi all,
I have this piece of code
class progess():
def __init__(self, number, char):
total = number
percentage = number
while percentage > 0 :
percentage = int(number/total*100)
number-=1
char+="*"
p
On Fri, May 22, 2009 at 11:17 AM, Joel Ross wrote:
> Hi all,
>
> I have this piece of code
>
> class progess():
>
> def __init__(self, number, char):
>
> total = number
> percentage = number
> while percentage > 0 :
> percentage = int(number/total*100)
>
On Fri, May 22, 2009 at 2:47 PM, Joel Ross wrote:
> Hi all,
>
> I have this piece of code
>
> class progess():
>
> def __init__(self, number, char):
>
> total = number
> percentage = number
> while percentage > 0 :
> percentage = int(number/total*100)
>
Hi all,
I have this piece of code
class progess():
def __init__(self, number, char):
total = number
percentage = number
while percentage > 0 :
percentage = int(number/total*100)
number-=1
char+="*"
print char
progess
"Philip Semanchuk" wrote:
8< nice explanation
> Change the "and" to an "or" and you'll get the result you expected.
Also google for "De Morgan", or "De Morgan's laws"
Almost everybody stumbles over this or one of it's
corollaries at least once in their careers
roups.com>,
>
>
>
> "bowman.jos...@gmail.com" wrote:
> > Hi,
>
> > I'm trying to write a multi-conditional while statement, and am having
> > problems. I've broken it down to this simple demo.
>
> > #!/usr/bin/python2.5
>
> > condition1 = False
In article
<40a44d6b-c638-464d-b166-ef66496a0...@l16g2000yqo.googlegroups.com>,
"bowman.jos...@gmail.com" wrote:
> Hi,
>
> I'm trying to write a multi-conditional while statement, and am having
> problems. I've broken it down to this simple demo.
>
On Jan 6, 2009, at 7:18 PM, bowman.jos...@gmail.com wrote:
Hi,
I'm trying to write a multi-conditional while statement, and am having
problems. I've broken it down to this simple demo.
#!/usr/bin/python2.5
condition1 = False
condition2 = False
while not condition1 and not
Hi,
I'm trying to write a multi-conditional while statement, and am having
problems. I've broken it down to this simple demo.
#!/usr/bin/python2.5
condition1 = False
condition2 = False
while not condition1 and not condition2:
print 'conditions met'
if condition1
> "b" == brianr <[EMAIL PROTECTED]> writes:
b> (As a matter of interest, is this sequence of posts intended to
b> demonstrate ignorance of both languages, or just one?)
Intentional fallacy -- there's no necessary correlation between what
he *intends* to do and what he actually succee
Xah Lee ([EMAIL PROTECTED]) wrote on CLIII September MCMXCIII in
news:[EMAIL PROTECTED]>:
.. # here's a while statement in python.
..
.. a,b = 0,1
.. while b < 20:
.. print b
IndentationError: expected an indented block
.. a,b = b,a+b
You have already proven you don'
Xah Lee wrote:
# here's a while statement in python.
a,b = 0,1
while b < 20:
print b
a,b = b,a+b
---
# here's the same code in perl
($a,$b)=(0,1);
while ($b<20) {
print $b, "\n";
($a,$b)= ($b, $a+$b);
}
Because you're posting this to newsgroups, it
Steven Bethard wrote:
Xah Lee wrote:
[some Python code]
Because you're posting this to newsgroups, it would be advisable to use
only spaces for indentation -- tabs are removed by a lot of newsreaders,
which means your Python readers are going to complain about
IndentationErrors.
Unfortunately, t
[EMAIL PROTECTED] schrieb:
"Xah Lee" <[EMAIL PROTECTED]> writes:
[...]
(As a matter of interest, is this sequence of posts intended to
demonstrate ignorance of both languages, or just one?)
:)
This sequence of posts is intended to stir up a debate just for
the sake of a debate. It's a time sink. It
"Xah Lee" <[EMAIL PROTECTED]> writes:
> # here's a while statement in python.
>
> a,b = 0,1
> while b < 20:
> print b
> a,b = b,a+b
>
> ---
> # here's the same code in perl
>
> ($a,$b)=(0,1);
> while ($b<20) {
> p
Xah Lee wrote:
# here's a while statement in python.
> [...]
>
# here's the same code in perl
[...]
So?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
# here's a while statement in python.
a,b = 0,1
while b < 20:
print b
a,b = b,a+b
---
# here's the same code in perl
($a,$b)=(0,1);
while ($b<20) {
print $b, "\n";
($a,$b)= ($b, $a+$b);
}
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
54 matches
Mail list logo