USE *
TO MULTIPLY NUMBERS
Use the asterisk character *
to multiply two numbers. If both numbers are int
types, the product will be an int
. If one or both of the numbers are float
types, the product will be a float
.
product = 2 * 3
Multiply 2 and 3
print(product)
OUTPUT
6
product = 2.0 * 3
Multiply 2.0 and 3
print(product)
OUTPUT
6.0
Warning: Multiplying a
string
by anint
will repeat the string. So,"2" * 3
results in"222"