On 02/06/15 00:42, Alan Gauld wrote:
forwordintext:
ifwordnot inwords:
words[word] =1
else:
words[word] +=1
Look into the setdefault() method of dictionaries.
It can replace the if/else above.
On reflec
Forwarding to list.
Always use ReplyAll (or reply List if you have that option) to include
the list.
Forwarded Message
Subject:Re: [Tutor] Parsing/Crawling test College Class Site.
Date: Mon, 1 Jun 2015 20:42:48 -0400
From: bruce
To: Alan Gauld
Seriously
Good evening,
As you may have noticed i am really struggling with functions and dictionaries.
I need to figure out why this program is allowing me to continue entering
incorrect data instead of telling me my answer is incorrect. also at the end
it’s not tallying the incorrect/correct responses
thanks on the help. I am now stuck on this program for quizzing on state
capitals. Do you mind taking a look please? I can’t get it to tell me the
answer is incorrect it just keeps asking me for capitals whether the answer is
right or wrong. It also is not giving me correct counts for correct an
Stephanie Quiles wrote:
> Good evening,
>
> As you may have noticed i am really struggling with functions and
> dictionaries. I need to figure out why this program is allowing me to
> continue entering incorrect data instead of telling me my answer is
> incorrect. also at the end it’s not tallyin
In a message of Mon, 01 Jun 2015 15:50:26 -0400, Ila Kumar writes:
>Hello,
>
>I am a new Python user attempting to use bioread (
>https://pypi.python.org/pypi/bioread/0.9.5) to convert files from
>aqknowledge to matlab. I am using a 64-bit PC, and I have downloaded
>Matlab, Python, numpy, scipy and
On 02/06/15 02:35, Stephanie Quiles wrote:
import pickle
You don;t need pickle
def main():
right = 0
wrong = 0
capitals = {'Alabama': 'Montgomery', 'Alaska': 'Juneau', \
\
"Arizona": 'Phoenix', \
You don't need the \
Inside {} you can put newlines as much a
On 02/06/15 08:27, Alan Gauld wrote:
The following is a sample of the test code, as well as the url/posts
of the pages as produced by the Firefox/Firebug process.
I'm not really answering your question but addressing some
issues in your code...
execfile('/apps/parseapp2/ascii_strip.py')
exec
On 02/06/2015 07:59, Steven D'Aprano wrote:
Please keep your replies on the tutor list, so that others may offer
advice, and learn from your questions.
Thanks,
Steve
On Mon, Jun 01, 2015 at 06:03:08PM +0100, Sydney Shall wrote:
On 31/05/2015 00:41, Steven D'Aprano wrote:
On Sat, May 30, 2015
On Tue, Jun 2, 2015 at 3:43 AM, Peter Otten <__pete...@web.de> wrote:
> Stephanie Quiles wrote:
>
>> Good evening,
>>
>> As you may have noticed i am really struggling with functions and
>> dictionaries. I need to figure out why this program is allowing me to
>> continue entering incorrect data ins
I'm a newbie, but was able to tune it to correctly reply to user inputs.
1. My question is can it be optimized in any way?
2. Why (on Windows) do I have to give inputs in quotes not to cause an error
(for ll input the error is ' NameError: name 'll' is not defined')?
def main():
right = 0
ZBUDNIEWEK. JAKUB wrote:
> I'm a newbie, but was able to tune it to correctly reply to user inputs.
> 2. Why (on Windows) do I have to give inputs in quotes not to cause an
> error (for ll input the error is ' NameError: name 'll' is not defined')?
If you are running the script under Python 2 yo
Thank you all for your help! I have a text today but I am not confident with
this. So basically, what I did wrong was the indentation?
Thanks
Stephanie Quiles
Sent from my iPhone
> On Jun 2, 2015, at 10:15 AM, Peter Otten <__pete...@web.de> wrote:
>
> ZBUDNIEWEK. JAKUB wrote:
>
>> I'm a new
On 02/06/15 15:50, Stephanie Quiles wrote:
> So basically, what I did wrong was the indentation?
Yes.
In Python indentation is all important.
When you write a for (or while) loop Python executes all the
indented code under the opening loop statement. When it sees
an unindented statement it reads
On 02/06/15 15:15, Peter Otten wrote:
Not an optimization, but if the user enters neither Y nor N you might ask
again instead of assuming Y.
He does. He only breaks if the user enters N
choice = input('Do you want to play again y/n: ')
if choice.upper() == 'N':
On 02/06/15 09:45, ZBUDNIEWEK.JAKUB wrote:
I'm a newbie, but was able to tune it to correctly reply to user inputs.
1. My question is can it be optimized in any way?
Code can nearly always be optimised.
Whether it is worth doing so depends on the need to do so.
In this case I douybt its worthwh
Alan Gauld wrote:
> On 02/06/15 15:15, Peter Otten wrote:
>
>> Not an optimization, but if the user enters neither Y nor N you might ask
>> again instead of assuming Y.
>
> He does. He only breaks if the user enters N
>
>>> choice = input('Do you want to play again y/n: ')
>>>
What is the +k+ called? How exactly does it work? I'm a big confused on
that...
Stephanie Quiles
Sent from my iPhone
> On Jun 2, 2015, at 12:17 PM, Peter Otten <__pete...@web.de> wrote:
>
> Alan Gauld wrote:
>
>>> On 02/06/15 15:15, Peter Otten wrote:
>>>
>>> Not an optimization, but if the
On 02/06/15 17:17, Peter Otten wrote:
choice = input('Do you want to play again y/n: ')
if choice.upper() == 'N':
print('end of game')
break
elif choice.upper() != 'Y':
print("invalid choice")
Y goes round again silently.
On 02/06/15 17:25, Stephanie Quiles wrote:
What is the +k+ called? How exactly does it work? I'm a big confused on that...
You seem to be replying to the wrong post.
I assume you mean this one from Joel?
-
>> for k in capitals.keys():
>> state = input('Enter the
On 31/05/2015 03:00, Cameron Simpson wrote:
On 30May2015 12:16, Sydney Shall wrote:
Following advice from you generous people, I have chosen a project
>that interests me, to develop some knowledge of python.
My projest is a simulation of a biological population.
I have a base class and a simula
21 matches
Mail list logo