Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Dinu Gherman Newsgroups: de.comp.lang.python Subject: Re: [Python-de] Wo ist der Fehler Date: Wed, 2 Nov 2016 11:56:10 +0100 Lines: 84 Message-ID: References: <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> <496101aa-65f7-e529-73e9-75f22a56260f@mail.de> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de U2GEbSrXMy3sBrWGoWF6MwIFj22Ehlq5+BArHsf4kxWA== Return-Path: X-Original-To: python-de@python.org Delivered-To: python-de@mail.python.org X-Envelope-From: gherman@darwin.in-berlin.de In-Reply-To: <496101aa-65f7-e529-73e9-75f22a56260f@mail.de> X-Mailer: Apple Mail (2.3124) X-BeenThere: python-de@python.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Die Deutsche Python Mailingliste List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> <496101aa-65f7-e529-73e9-75f22a56260f@mail.de> Xref: csiph.com de.comp.lang.python:4572 On 02 Nov 2016, at 10:23, Sven R. Kunze wrote: >=20 > On 02.11.2016 10:06, Mario Schr=C3=B6der wrote: >> Hi =F0=9F=91=8B >>=20 >> Bei einem meiner ersten Coding Aufgabe habe ich gleich mal einen = Fehler, den ich seit drei Wochen mit mir rumschleppe und nicht weiter = kommen ;-( >>=20 >> Also das Problem liegt in der If Schleife soviel wei=C3=9F ich schon = ... >>=20 >> Kann mir jemand mit dem ganzen Zaun winken ??? >>=20 >> Check out my code on Repl.it: https://repl.it/EDUE/3 >>=20 >> Mit freundlichen Gr=C3=BC=C3=9Fen >>=20 >> Mario Schr=C3=B6der >=20 >=20 > Meinst du den Fehler? >=20 >=20 > The current paragraph reads as such: >=20 > Python uses dynamic typing and a mix of reference counting and a = cycle-detecting garbage collector for memory management. An important = feature of Python is dynamic name resolution (late binding), which binds = method and variable names during __2__ execution.Python uses __3__ = indentation to delimit blocks - rather than curly braces or keywords. An = increase in indentation comes after certain statements; a decrease in = indentation signifies the end of the current block.[54] This feature is = also sometimes termed the off-side rule. > What is the correct filling in for __2__ ? runtime > Traceback (most recent call last): > File "python", line 134, in > File "python", line 125, in playing_the_game > File "python", line 85, in filling_blanks > File "python", line 105, in showing_phrases > UnboundLocalError: local variable 'prompt' referenced before = assignment >=20 >=20 > Ich w=C3=BCrde mal sagen: in den Zeilen 96 bis 101 solltest du die = Variable "Prompt initilialisieren. ;) >=20 > Beispiel: >=20 > prompt +=3D 'xx' >=20 >=20 > Wenn prompt nicht initialisiert wurde, dann kann nichts dazu addiert = werden. Macht das Sinn? >=20 >=20 > Gef=C3=BChlt scheinst du lokale und globale Variablen in der Funktion = showing_phrases zu mixen. Ich denke, es w=C3=A4re gut, das zu vermeiden. >=20 >=20 > Schickes Console-Game! +1 Hallo zusammen! Hier mein neuer Vorschlag f=C3=BCr eine konstruktive Standardantwort: = ;-) - = http://www.oreilly.com/programming/free/how-to-make-mistakes-in-python.csp= - = http://www.oreilly.com/programming/free/files/how-to-make-mistakes-in-pyth= on.pdf Mehr davon kann man sich mit einem noch nicht so ganz fertigen Tool von = mir besorgen (irgendwann bekommt es dann auch sein eigenes Repo): https://github.com/deeplook/scrape-fu/tree/master/freebora Happy coding! Dinu