You have at least one error in your graph. Specifically, if you are using:
###
graph = {'q9': ['q10', 'q33'], 'q10': ['q11', 'q 28', 'q29', 'q30'],
'q11': ['q15'] , 'q16': ['q17', 'q19', 'q24'],' q18': ['q20'], 'q23':
['q34'], 'q24': [
On Sun, Nov 24, 2013 at 10:32:20PM +0100, Rafael Knuth wrote:
> Hej there,
>
> I stumbled upon the "continue" statement and to me it looks like it
> does exactly the same as else. I tested both else and continue in a
> little program and I don't see any differences between both.
"continue" and "
On Sun, Nov 24, 2013 at 8:22 PM, Joel Goldstick
wrote:
> On Sun, Nov 24, 2013 at 8:12 PM, Steven D'Aprano wrote:
>> On Sun, Nov 24, 2013 at 09:33:11PM +0530, Reuben wrote:
>> [...]
>>> From the above output, I see key 'c' is at third position during input, but
>>> while displaying the output it i
On Sun, Nov 24, 2013 at 8:12 PM, Steven D'Aprano wrote:
> On Sun, Nov 24, 2013 at 09:33:11PM +0530, Reuben wrote:
> [...]
>> From the above output, I see key 'c' is at third position during input, but
>> while displaying the output it is displayed at second position
>
> Dictionaries are deliberate
On Sun, Nov 24, 2013 at 09:33:11PM +0530, Reuben wrote:
[...]
> From the above output, I see key 'c' is at third position during input, but
> while displaying the output it is displayed at second position
Dictionaries are deliberately made unordered. That means the order that
items will be displa
On 24/11/2013 21:41, Dominik George wrote:
Hi,
I stumbled upon the "continue" statement and to me it looks like it
does exactly the same as else. I tested both else and continue in a
little program and I don't see any differences between both. Is my
assumption correct or wrong? If the latter is
On 24/11/13 22:38, Alan Gauld wrote:
Responding to my own post, never a good sign :-(
primes = []
for n in range(1000)
if n%2 == 0: even numbers aren't prime
continue
else:
if isPrime(n):
primes.append(n)
Now the continue means the isPrime test never gets execut
On 24/11/13 21:32, Rafael Knuth wrote:
I stumbled upon the "continue" statement and to me it looks like it
does exactly the same as else. I tested both else and continue in a
little program and I don't see any differences between both.
for num in range(2,10):
if num % 2 == 0:
prin
On Sun, Nov 24, 2013 at 4:41 PM, Dominik George wrote:
> Hi,
>
>> I stumbled upon the "continue" statement and to me it looks like it
>> does exactly the same as else. I tested both else and continue in a
>> little program and I don't see any differences between both. Is my
>> assumption correct o
Hi,
> I stumbled upon the "continue" statement and to me it looks like it
> does exactly the same as else. I tested both else and continue in a
> little program and I don't see any differences between both. Is my
> assumption correct or wrong? If the latter is the case: Can you give
> me examples
On Mon, Nov 25, 2013 at 2:55 AM, Joel Goldstick
wrote:
> On Sun, Nov 24, 2013 at 11:03 AM, Reuben wrote:
>> Hi,
>>
>> ##
>
> new_dict = {'a':10, 'b' :20, 'c': 30,'d' : 40}
>
>
> print new_dict
>> {'a': 10, 'c': 30, 'b': 20, 'd': 40}
Hej there,
I stumbled upon the "continue" statement and to me it looks like it
does exactly the same as else. I tested both else and continue in a
little program and I don't see any differences between both. Is my
assumption correct or wrong? If the latter is the case: Can you give
me examples of
On Sun, Nov 24, 2013 at 11:03 AM, Reuben wrote:
> Hi,
>
> ##
new_dict = {'a':10, 'b' :20, 'c': 30,'d' : 40}
print new_dict
> {'a': 10, 'c': 30, 'b': 20, 'd': 40}
>
>
> #
>
>
> From the abo
So I cleaned up the code to make it readable. I'm not getting an error
message now. What I'm getting is an empty bracket. I want to run
find_all_paths with my graph and then list the start and end point (in this
case that's q9 and q42) and then have it list a tuple of each path in a
separate line.
Hi,
##
>>>
>>> new_dict = {'a':10, 'b' :20, 'c': 30,'d' : 40}
>>>
>>>
>>> print new_dict
{'a': 10, 'c': 30, 'b': 20, 'd': 40}
>>>
#
>From the above output, I see key 'c' is at third position during input, but
while
On 24/11/13 13:05, Rafael Knuth wrote:
"a" and "b" on the left side are unchangable tuples and they simply get
unpacked on the right side.
Be careful about terminology here. a,b is a single tuple with two
values. But a and b are variables not tuples.
Tuples are collections of (one or more)
On Sun, Nov 24, 2013 at 08:51:41AM +0100, Rafael Knuth wrote:
> > So, what to do about it? While the Python interactive interpreter is
> > mighty powerful, it does have some limitations, and this is one of them.
> > You just have to get used to the fact that it is not well-suited for
> > editing la
Now I got it, thanks :-)
a, b = b, b + a
... I was was wrongly assuming that "a" and "b" on the left side "talk" to
each other and that "a" tells "b" something like: "Hey 'b' ... I just
assigned another value to you, make sure you execute it." But "a" and "b"
don't talk to each other. Each of th
On Sun, 24 Nov 2013 11:24:43 +0100, Rafael Knuth
wrote:
a, b = b, a +b
a = b = 1
b = a + b = 1 + 1 = 2
I suggest you play with the statement a bit. Print out both values
each time through the loop.
The expression b, a+b produces a tuple. The left side a, b *unpacks*
that tuple into
Hi,
> a, b = b, a +b
> a = b = 1
> b = a + b = 1 + 1 = 2
Your issue is that you interpret the assignment wrong. You seem to think
that it assigns b to a and THEN a+b to b, which is not the case. The
right side of the assignment creates a tuple, and the left side unpacks
it. It is the same as
Hej there,
I am making a couple wrong assumptions about the program below, but I
do not know where my thinking mistake is. I have some trouble
understanding what exactly happens within this loop here:
a, b = 0, 1
while b < 10:
print(b)
a, b = b, a +b
What I would expect as an outcome of
On 24/11/13 07:51, Rafael Knuth wrote:
So, what to do about it? While the Python interactive interpreter is
mighty powerful, it does have some limitations, and this is one of them.
You just have to get used to the fact that it is not well-suited for
editing large blocks of code. ...
Understood.
22 matches
Mail list logo