Sujet : Re: Multiplication
De : PythonList (at) *nospam* DancesWithMice.info (dn)
Groupes : comp.lang.pythonDate : 01. Apr 2024, 22:02:22
Autres entêtes
Organisation : DWM
Message-ID : <mailman.54.1712002101.3468.python-list@python.org>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
The April Fools joke was on those of us who never received/have yet to receive @Stefan's OP.
On 2/04/24 08:02, Avi Gross via Python-list wrote:
Is this a April 1 post for fools.
Multiplication with an asterisk symbol is built into python.
The same symbol used in other contexts has other contexts has an assortment
of largely unrelated meanings such as meaning everything when used to
import.
On Mon, Apr 1, 2024, 1:27 PM Piergiorgio Sartor via Python-list <
python-list@python.org> wrote:
On 01/04/2024 10.40, Stefan Ram wrote:
Q: How can I multiply two variables in Python? I tried:
>
a = 2
b = 3
print( ab )
>
but it did not work.
>
A: No, this cannot work. To multiply, you need the multiplication
operator. You can import the multiplication operator from "math":
>
Code example:
>
from math import *
>
a = 2
b = 3
print( a * b )
>
I guess the operator "*" can be imported from any module... :-)
>
bye,
>
--
>
piergiorgio
>
--
https://mail.python.org/mailman/listinfo/python-list
>
-- Regards,=dn