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

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -