# python help how to multiplication two vareibles numbers

## Recommended Posts

import math
import random

print("picle price is changing every day")
piclePrice = random.randint(3,9)
picleamount = input("Enter picle amounth:")

print(' price: '+piclePrice)

results = (picleamount*piclePrice)
print(results)
#once i put amount i get the price
##### Share on other sites

• 2 years later...

To multiply two variables in Python, both variables need to be of numeric types (e.g., integers or floats). In your code, the `picleamount` variable is being read as a string from the input function. You need to convert it to an integer or float before performing the multiplication.

Here is the corrected version of your script:

```import random

print("Pickle price is changing every day")
pickle_price = random.randint(3, 9)
pickle_amount = int(input("Enter pickle amount:"))

print('Price per pickle:', pickle_price)

# Calculate the total price
total_price = pickle_amount * pickle_price
print('Total price:', total_price)```