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

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -