Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4572
| From | Dinu Gherman <gherman@darwin.in-berlin.de> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] Wo ist der Fehler |
| Date | 2016-11-02 11:56 +0100 |
| Message-ID | <mailman.51.1478084700.17234.python-de@python.org> (permalink) |
| References | <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> <496101aa-65f7-e529-73e9-75f22a56260f@mail.de> <B0BEAC01-A5E8-48D7-822B-0DECE812D6BC@darwin.in-berlin.de> |
On 02 Nov 2016, at 10:23, Sven R. Kunze <srkunze@mail.de> wrote: > > 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 <module> > 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 Hallo zusammen! Hier mein neuer Vorschlag für 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-python.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
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] Wo ist der Fehler Dinu Gherman <gherman@darwin.in-berlin.de> - 2016-11-02 11:56 +0100
csiph-web