Wie füge ich 2,50 zu den Kosten hinzu?Hinzufügen einer Zahl mit 2 Dezimalstellen zu einer Variablen (2.50)
es jetzt druckt er nur aus als 2.
cost = 0.00
r = open("toppings.txt")
bases = ["small","medium","large"]
toppings = ["Pepperoni","Chicken","Cajun Chicken","Mushrooms",
"Red Onions","Sweetcorn","Ham","Cheese","Spicy Minced Beef",
"Anchovies","Tuna","Peppers","Jalapenos","Green Chillies"] #0-13
def small():
current = cost + 2.50
print("Your current total cost is " + "£" + str(int(current)))
int (strom) entfernen und str (strom) direkt verwenden. –
Nun entfernen Sie einfach die int() – DZDomi
'print (" Ihre aktuellen Gesamtkosten sind £% 2f "% Strom)' – Bodhi94