• Multiplication

    From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.lang.python on Mon Apr 1 08:40:41 2024
    From Newsgroup: comp.lang.python

    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 )
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Piergiorgio Sartor@piergiorgio.sartor.this.should.not.be.used@nexgo.REMOVETHIS.de to comp.lang.python on Mon Apr 1 10:51:05 2024
    From Newsgroup: comp.lang.python

    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

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Joel Goldstick@joel.goldstick@gmail.com to comp.lang.python on Mon Apr 1 13:35:26 2024
    From Newsgroup: comp.lang.python

    On Mon, Apr 1, 2024 at 1:26 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
    a = 3
    b = 5
    print(a*b)
    15

    No import is necessary.
    --
    Joel Goldstick
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From D'Arcy Cain@darcy@VybeNetworks.com to comp.lang.python on Mon Apr 1 13:34:36 2024
    From Newsgroup: comp.lang.python

    On 2024-04-01 12:35, Joel Goldstick via Python-list wrote:
    On Mon, Apr 1, 2024 at 1:26 PM Piergiorgio Sartor via Python-list
    ^^^^^^^^^^^

    from math import *

    a = 2
    b = 3
    print( a * b )

    I guess the operator "*" can be imported from any module... :-)
    No import is necessary.

    Of course not. Check the date on the message.
    --
    D'Arcy J.M. Cain
    Vybe Networks Inc.
    http://www.VybeNetworks.com/
    IM:darcy@Vex.Net VoIP: sip:darcy@VybeNetworks.com

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Avi Gross@avi.e.gross@gmail.com to comp.lang.python on Mon Apr 1 15:02:46 2024
    From Newsgroup: comp.lang.python

    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

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From dn@PythonList@DancesWithMice.info to comp.lang.python on Tue Apr 2 09:02:22 2024
    From Newsgroup: comp.lang.python

    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
    --- Synchronet 3.20a-Linux NewsLink 1.114