-6
\$\begingroup\$

Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, or any loops whatsoever

This is code-golf, so shortest code wins!

Test cases: i dont know if you even need it! lol

1,0 -> 0

5,6 -> 30

3920,549 -> 2152080

\$\endgroup\$
3
  • 6
    \$\begingroup\$ Not only is this a duplicate of existing challenges, but it suffers the same lack of clarity they did: "you cannot use the multiplication operator or loops" is not a well-defined requirement, on top of being unobservable \$\endgroup\$
    – pxeger
    Jan 10, 2022 at 9:59
  • 1
    \$\begingroup\$ Can I use chr(42)? \$\endgroup\$
    – Fmbalbuena
    Jan 10, 2022 at 10:01
  • 6
    \$\begingroup\$ In addition to what @pxeger mentions above, do X without Y challenges are pretty hard to write proper challenges for, and it's advised to avoid until you have a bit more experience writing challenges. It's also best to use the Sandbox of proposed challenges to get feedback before posting it to main. \$\endgroup\$ Jan 10, 2022 at 10:02

2 Answers 2

0
\$\begingroup\$

05AB1E, 6 bytes

',¡`иO

Try it online or verify all test cases.

Would be 2 bytes without the restricted input-format:

иO

Try it online or verify all test cases.

Explanation:

',¡    '# Split the (implicit) input-string on ","
   `    # Pop and push both values separated to the stack
    и   # Repeat the first value the second value amount of times as list
     O  # Sum that list
        # (after which the result is output implicitly)
\$\endgroup\$
0
\$\begingroup\$

Python 3, 32 bytes

lambda x,y:eval("x"+chr(42)+"y")

Try it online!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ @DialFrost this is repeat, not multiply \$\endgroup\$
    – Fmbalbuena
    Jan 10, 2022 at 9:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.