Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #4571

Re: [Python-de] Wo ist der Fehler

From "Sven R. Kunze" <srkunze@mail.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Wo ist der Fehler
Date 2016-11-02 10:23 +0100
Message-ID <mailman.50.1478078612.17234.python-de@python.org> (permalink)
References <85B72761-2E99-4B83-88B9-588A1467C6D0@gmail.com> <496101aa-65f7-e529-73e9-75f22a56260f@mail.de>

Show all headers | View raw


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


Sven

Back to de.comp.lang.python | Previous | Next | Find similar


Thread

Re: [Python-de] Wo ist der Fehler "Sven R. Kunze" <srkunze@mail.de> - 2016-11-02 10:23 +0100

csiph-web