Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Anfängerfrage

0 views
Skip to first unread message

kas

unread,
Feb 8, 2010, 4:11:39 AM2/8/10
to
Was macht
a,b=b,a%b

Diez B. Roggisch

unread,
Feb 8, 2010, 4:44:13 AM2/8/10
to
Am 08.02.10 10:11, schrieb kas:
> Was macht
> a,b=b,a%b

Wie waer's mal mit ausprobieren?

>>> a = 7
>>> b = 3
>>> a,b=b, a % b
>>> print a, b
3 1
>>>


Prozent ist der sogenannte Modulo-operator, und ansonsten kommt da noch
sogenanntes tuple-unpacking zum tragen.

Diez

kas

unread,
Feb 8, 2010, 6:15:56 AM2/8/10
to

"tuple-unpacking" hat mir weitergeholfen.
Danke

Malte Dik

unread,
Feb 13, 2010, 11:37:39 PM2/13/10
to
>>> a = "string"
>>> b = "strong %s"
>>> b,a = a, b%a
>>> print a,b


quote:

0 new messages