ich bin noch Anfänger und arbeite gerade an einem fortgeschrittenem Skript mit ein paar Schwierigkeiten mit Input und Output, return von einem int() und sekundär auch mit Formatierungsproblemen.
Die Aufgabenstellung ist:
https://210309ww6uxcynlnxts.nextcloud.h ... Jkgn2wqyqN
Mein Code sieht bisher so aus:
Code: Alles auswählen
print(format("Backshop BACK WELT", "^15"))
vorname = str(input("Geben sie ihren Vornamen ein: "))
nachname = str(input("Geben sie ihren Nachname ein: "))
#vorname = print(input("Geben sie ihren Vorname ein:" " "))
#nachname = print(input("Geben sie ihren Nachnamen ein:" " "))
print(str("Geben sie die Anzahl der jeweils gekauften Artikel ein."))
breze = print(int(input("Breze: ")))
semmel = print(int(input("Semmel: ")))
baguette = print(int(input("Baguette: ")))
dineklvolkornbrot = print(int(input("Dinekl Volkornbrot: ")))
print("Der Kassenbon von", vorname, nachname)
print("-" * 62)
print(format("Artikel", "15"),
format("Euro/Stück", "15"),
format("Anzahl", "15"),
format("Zwischensumme", "15"))
print("-" * 62)
brezeP = int(0.75)
semmelP = int(0.50)
baguetteP = int(2.10)
dineklvolkornbrotP = int(3.70)
print(format("Breze", "15"), format(breze, "15"), format(brezeP, "15"), format(breze * brezeP, "15"))
print(format("Semmel", "15"), format(semmel, "15"), format(semmelP, "15"), format(semmel * semmelP, "15"))
print(format("Baguette", "15"), format(baguette, "15"), format(baguetteP, "15"), format(baguette * baguetteP, "15"))
print(format("Dinekl Volkornbrot", "15"),format(dineklvolkornbrot, "15"), format(dineklvolkornbrotP, "15"), format(dineklvolkornbrot * dineklvolkornbrotP, "15"))
Shall:
Traceback (most recent call last):
File "/Users/admin/Documents/05 - Coding/04 - Thonny/Backshop.py", line 11
breze = print(int(input("Breze: ")), return)
^
SyntaxError: invalid syntax
Assistant:
TypeError: unsupported format string passed to NoneType.__format__
Backshop.py, line 32
Python was asked to do an operation with an object which doesn't support it.
Warnings
May help you find the cause of the error.
Backshop.py
Line 11 : "print" does not return a value
Line 12 : "print" does not return a value
Line 13 : "print" does not return a value
Line 14 : "print" does not return a value
Das Problem ist, das ich die Zahl auf den Integern von breze, semmel, baguette, dineklvolkornbrot brauche. Wenn die gleich mit print() anfange, weiss ich nicht, wie ich den Wert auslesen kann.
Ich hoffe dazu hat jemand eine Ahnung.
Herzlichen Dank!
Richard