Why isn't this code working how I want it to?

2013-10-12 Thread reubennottage
I've been working on a program and have had to halt it due a slight problem. Here's a basic version of the code: a = 'filled' b = 'filled' c = 'empty' d = 'empty' e = 'filled' f = 'empty' g = 'filled' testdict = {a : 'apple' , b : 'banana' , c : 'cake' , d : 'damson' , e : 'eggs' , f : 'fish'

Re: Why isn't this code working how I want it to?

2013-10-12 Thread Marco Nawijn
On Saturday, October 12, 2013 10:56:27 AM UTC+2, reuben...@gmail.com wrote: I've been working on a program and have had to halt it due a slight problem. Here's a basic version of the code: a = 'filled' b = 'filled' c = 'empty' d = 'empty' e = 'filled' f = 'empty' g =

Re: Why isn't this code working how I want it to?

2013-10-12 Thread Peter Otten
reubennott...@gmail.com wrote: I've been working on a program and have had to halt it due a slight problem. Here's a basic version of the code: a = 'filled' b = 'filled' c = 'empty' d = 'empty' e = 'filled' f = 'empty' g = 'filled' testdict = {a : 'apple' , b : 'banana' , c : 'cake'

Re: Why isn't this code working how I want it to?

2013-10-12 Thread Mark Lawrence
On 12/10/2013 09:56, reubennott...@gmail.com wrote: I've been working on a program and have had to halt it due a slight problem. Here's a basic version of the code: a = 'filled' b = 'filled' c = 'empty' d = 'empty' e = 'filled' f = 'empty' g = 'filled' testdict = {a : 'apple' , b : 'banana' ,

Re: Why isn't this code working how I want it to?

2013-10-12 Thread Jussi Piitulainen
reubennott...@gmail.com writes: [...] The following doesn't work. for fillempt in testdict: if fillempt == 'filled': print(testdict[fillempt]) This is equivalent to for fillempt in testdict: if fillempt == 'filled': print(testdict['filled']) which in turn can be

Re: Why isn't this code working how I want it to?

2013-10-12 Thread reubennottage
On Saturday, October 12, 2013 10:20:24 AM UTC+1, Peter Otten wrote: reubennott...@gmail.com wrote: I've been working on a program and have had to halt it due a slight problem. Here's a basic version of the code: a = 'filled' b = 'filled' c = 'empty' d = 'empty'

Re: Why isn't this code working how I want it to?

2013-10-12 Thread Mark Lawrence
On 12/10/2013 12:03, reubennott...@gmail.com wrote: On Saturday, October 12, 2013 10:20:24 AM UTC+1, Peter Otten wrote: reubennott...@gmail.com wrote: I've been working on a program and have had to halt it due a slight problem. Here's a basic version of the code: a = 'filled' b