How do I multiply a map of a variable in Python? -
here's code:
elif cmd == "pay dog": name = input("dog name? ") d in dogs: if d["name"] == name: print(d["name"] + " owes $" + d["days"])
how multiply d["days"] person has pay $30 each day? mean is, how multiply d["days"] 30?
as see, d["days"]
string.
try this:
print(d["name"] + " owes $" + str(30 * int(d["days"])))
or this:
print("%s owes $%d" % (d["name"], (30 * int(d["days"]))))
Comments
Post a Comment