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
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
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
I've CCd the list. Please use reply all when responding to the list.
Also please use plain text as HTML/RTF doesn't work on all
systems and code in particular often gets mangled.
On 01/06/15 23:59, Stephanie Quiles wrote:
Hello again,
here is the final code… I think :) please see below. Is this
On 06/01/2015 05:56 PM, Alan Gauld wrote:
if text in line:
count += 1
print("This word appears", count, "times in the file")
And this is, of course, completely off track. You need
to split the line into its separate words and store
each word into the dictionary.
OP may want
On 01/06/15 05:01, Stephanie Quiles wrote:
Hello. i need serious help. i am a very very new python programmer.
Welcome.
Write a program that reads the contents of a text file.
OK, Well you have done that bit OK.
The program should create a dictionary in which the
keys are the individual w