Hi,
On Thu, Aug 21, 2014 at 10:56 PM, Tim Roberts wrote:
> Seymore4Head wrote:
>>
>>I want to give the computer 100 tries to guess a random number between
>>1 and 100 picked by the computer.
>
> If it takes more than 7, you're doing it wrong...
I think he meant:
100 runs of the script...
Thank
Seymore4Head wrote:
>
>I want to give the computer 100 tries to guess a random number between
>1 and 100 picked by the computer.
If it takes more than 7, you're doing it wrong...
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
--
https://mail.python.org/mailman/listinfo/python-lis
On Thu, 21 Aug 2014 21:37:22 -0400, Seymore4Head wrote:
> I want to give the computer 100 tries to guess a random number between 1
> and 100 picked by the computer.
>
> For the moment I am always using 37 as the random pick. I want to
> change the pick to pick=random.randrange(1,100). The progr
Seymore4Head wrote:
> I want to give the computer 100 tries to guess a random number between
> 1 and 100 picked by the computer.
>
> For the moment I am always using 37 as the random pick. I want to
> change the pick to pick=random.randrange(1,100). The program works as
> expected until the com
On Fri, 22 Aug 2014 11:58:00 +1000, Chris Angelico
wrote:
>On Fri, Aug 22, 2014 at 11:37 AM, Seymore4Head
> wrote:
>> I want to give the computer 100 tries to guess a random number between
>> 1 and 100 picked by the computer.
>>
>
>Suggestion: Be up-front about this being a homework assignment. M
On Fri, Aug 22, 2014 at 12:13 PM, Seymore4Head
wrote:
> I tried puttingbreak_stmt ::= "break" at the point where I
> want to start over:) ,but since there is no "start ove"r command,
> I was happy to end the program.
>
> I get "invalid syntax so I triedbreak_stmt
Ah, that's part
On Fri, 22 Aug 2014 11:55:58 +1000, Ben Finney
wrote:
>Seymore4Head writes:
>
>> The program works as expected until the computer gets a correct guess.
>> I don't know what I should be doing to restart the program when
>> pick=guess.
>
>There isn't a restart the program code we can give. But I
On Fri, Aug 22, 2014 at 11:37 AM, Seymore4Head
wrote:
> I want to give the computer 100 tries to guess a random number between
> 1 and 100 picked by the computer.
>
Suggestion: Be up-front about this being a homework assignment. Most
of us can tell anyway, and it's more honest that way :)
So, si
Seymore4Head writes:
> The program works as expected until the computer gets a correct guess.
> I don't know what I should be doing to restart the program when
> pick=guess.
There isn't a “restart the program” code we can give. But I think you
need only something rather simpler:
> while count <
I want to give the computer 100 tries to guess a random number between
1 and 100 picked by the computer.
For the moment I am always using 37 as the random pick. I want to
change the pick to pick=random.randrange(1,100). The program works as
expected until the computer gets a correct guess. I do
Thank you very much everyone.
Regards,
-- Sengly
--
http://mail.python.org/mailman/listinfo/python-list
Sengly wrote:
I can hack it by doing eval('1.0*12/5') but is there any better method?
Where did you get the string? If you generated it, you might as well
make one or both the operands float to begin with. If you got it as
input, calling eval() on it is a world of security hurt.
The right w
Sengly wrote:
>I would like to calculate a string expression to a float. For example,
>I have ('12/5') and I want 2.4 as a result. I tried to use eval but it
>only gives me 2 instead of 2.5
py> from __future__ import division
py> print eval('12/5')
2.4
py> print eval('12//5')
2
Or switch to 3.0
On Dec 23, 9:49 pm, Sengly wrote:
> I can hack it by doing eval('1.0*12/5') but is there any better method?
from __future__ import division
--
http://mail.python.org/mailman/listinfo/python-list
I can hack it by doing eval('1.0*12/5') but is there any better method?
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 23, 4:46 am, Sengly wrote:
> Hello all,
>
> I would like to calculate a string expression to a float. For example,
> I have ('12/5') and I want 2.4 as a result. I tried to use eval but it
> only gives me 2 instead of 2.5
>
> Help!!!
>
> Regards,
>
> Sengly
>>> float('12')/float('5')
2.3999
Hello all,
I would like to calculate a string expression to a float. For example,
I have ('12/5') and I want 2.4 as a result. I tried to use eval but it
only gives me 2 instead of 2.5
Help!!!
Regards,
Sengly
--
http://mail.python.org/mailman/listinfo/python-list
WO Larry
that was very very smart...it works perfectly =)
--
http://mail.python.org/mailman/listinfo/python-list
aghazalp wrote:
> thanx ...it works great now...you re awesome...the only thing is that
> the program only executes once though...I guess I ll have to read up
> more anout it but for now that helped me a lot...I appreciated the help
>
It only executes once because you only call it once.
Your pro
thanx ...it works great now...you re awesome...the only thing is that
the program only executes once though...I guess I ll have to read up
more anout it but for now that helped me a lot...I appreciated the help
--
http://mail.python.org/mailman/listinfo/python-list
aghazalp wrote:
> hi guys,
> this would be the most basic question ever...I am not a programmer but
> I am trying to learn programming in python...I was reading John Zelle's
> text book and instructed me to make .py file and save it on the desk
> top...then it said close the python GUI and double c
thanx george for the prompt answer... when you say add a call that
means what exactly?...here is the program I was supposed to
write...could you tell me what to add where in this program?
def main():
print "this program is crazy"
x=input ('enter a number betwenen 0 and 1: ')
for i rang
hi guys,
this would be the most basic question ever...I am not a programmer but
I am trying to learn programming in python...I was reading John Zelle's
text book and instructed me to make .py file and save it on the desk
top...then it said close the python GUI and double click on the icon of
the I
aghazalp wrote:
> thanx george for the prompt answer... when you say add a call that
> means what exactly?...here is the program I was supposed to
> write...could you tell me what to add where in this program?
>
> def main():
> print "this program is crazy"
> x=input ('enter a number betwe
24 matches
Mail list logo