Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Sven R. Kunze" Newsgroups: de.comp.lang.python Subject: Re: [Python-de] Wo ist der Fehler Date: Wed, 2 Nov 2016 10:23:24 +0100 Lines: 58 Message-ID: References: <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> <496101aa-65f7-e529-73e9-75f22a56260f@mail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de fTGEzpUH+H4KDmM7qPhd1wFAsLAxCHZGMP9YChDTR4wg== Return-Path: X-Original-To: python-de@python.org Delivered-To: python-de@mail.python.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde201610; t=1478078604; bh=eVBgZ95HkryfNwVwOooYqOk36OYZzIGh2dzQEf6g9B4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=qaoABGzRwR5frWtB5dpyTbNqIwJjHT5RBMB3QiwnRYWv9LMXWm1nu7bRptkeCu1P8 /onf3RsMe45gcnB9nIcJj3Eqprxc4FV33Rq3d/oX1p8Vtw/aa3KfCsGUG12aXrEoyx U4wyModos1K1qXZI7PEckXwZDa9FA4AQCvKgtasA= In-Reply-To: <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1835 X-purgate-ID: 154282::1478078604-0000084F-E7BAA65E/0/0 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: <496101aa-65f7-e529-73e9-75f22a56260f@mail.de> X-Mailman-Original-References: <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> Xref: csiph.com de.comp.lang.python:4571 On 02.11.2016 10:06, Mario Schröder wrote: > Hi 👋 > > Bei einem meiner ersten Coding Aufgabe habe ich gleich mal einen Fehler, den ich seit drei Wochen mit mir rumschleppe und nicht weiter kommen ;-( > > Also das Problem liegt in der If Schleife soviel weiß ich schon ... > > Kann mir jemand mit dem ganzen Zaun winken ??? > > Check out my code on Repl.it: https://repl.it/EDUE/3 > > Mit freundlichen Grüßen > > Mario Schröder Meinst du den Fehler? The current paragraph reads as such: 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 Ich würde mal sagen: in den Zeilen 96 bis 101 solltest du die Variable "Prompt initilialisieren. ;) Beispiel: prompt += 'xx' Wenn prompt nicht initialisiert wurde, dann kann nichts dazu addiert werden. Macht das Sinn? Gefühlt scheinst du lokale und globale Variablen in der Funktion showing_phrases zu mixen. Ich denke, es wäre gut, das zu vermeiden. Schickes Console-Game! +1 Sven