Seite 1 von 1

input-Fehler

Verfasst: Dienstag 14. März 2017, 16:19
von sinusjones
Guten Tag,
ich versuche gerade das Programmieren zu lernen.
Gerade bin ich beim input-Befehl angekommen und auf ein Problem gestoßen, welches ich nicht lösen kann.

>>> x = input("Ihr Name? ")
Ihr Name? Jonas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
NameError: name 'Jonas' is not defined
>>> print(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'x' is not defined

Ich nutze das Tutorial von Python-Kurs.eu.

MfG

Re: input-Fehler

Verfasst: Dienstag 14. März 2017, 16:53
von BlackJack
@sinusjones: Nimm `raw_input()` statt `input()`. Eventuell solltest Du mal die Python-Version prüfen, also entweder Python 3.x und ein Tutorial für Python 3 verwenden, oder Python 2.7 und ein Tutorial für Python 2.

Re: input-Fehler

Verfasst: Mittwoch 15. März 2017, 17:54
von sinusjones
Vielen Dank für die schnelle Antwort.

Das war's! Hatte es zwischenzeitlich auch schon raus gefunden :mrgreen:

Gibt es hier ein "gelöst"- Häkchen oder sowas?

MfG