救命!我的计算器出现故障!


28

介绍

我的计算器很奇怪。有时,当我输入时8会显示2。有时,当我输入a 6时会显示+。一些按钮混在一起!
谁能帮我确定哪个?

挑战:

输入:错误方程式列表,结果正确

输出:交换的两个按钮。

例如:
输入可以是:

123    = 3
8423   = 252
4+4    = 8
4*7-10 = 417
9/3    = 3
42-9   = -36

其预期的输出是:2*

为什么?因为如果我们交换2和*,则所有等式都是正确的:

1*3    = 3
84*3   = 252
4+4    = 8
427-10 = 417
9/3    = 3
4*-9   = -36

挑战规则:

  • 输入可以采用任何合理的格式。可以是一个以空格分隔的字符串;字符串列表或-array; 一个包含方程式的列表和另一个包含正确结果的列表。你的来电。请说明您使用的输入格式!
    注意:这也意味着你被允许输入测试用例-5--15作为-5- -15-5 - -15。但是,--输入的结果应不带空格或每个数字之间带空格。因此,9119可以按9119或方式输入测试用例9 1 1 991 19不允许这样做是因为您随后可以被用于查找的空间所引导- -)。因此,空格是(某种程度上)可选的,并且是允许的。
  • 输出格式也可以是任何合理的格式。可以是两个字符;单个两个字符的字符串;包含两个字符的字符串列表。你的来电。同样,请说明您使用的输出格式!
  • 您可以使用映射到的任何14种不同的输出0123456789+-*/。因此,您甚至可以根据需要输出两个不同的整数(再次,请指定您使用的映射,如果有的话)。
  • 您只需要支持整数。因此,不会有类似1/8=0.125或的测试用例1/8=0
  • 您必须支持的算术操作数:加法(+); 减(-); 乘法(*×·); 除(/÷)。(注意:括号之间的字符仅作为说明添加。)
  • 您必须支持负数。这-可以在方程式中解释为数学操作数还是负数指示符。
  • 你可以假设给定的公式不正确和应该正确的方程是总是有效的(所以不会有类似的事情4-/29+-+8为例)。
  • 错误的输入方程式可能包含被0除的结果,但校正后的方程和期望方程将永远不会包含被0除的结果。
  • 即使您换回了预期的按钮,不正确的输入等式也可能已经正确。
  • 给定的输入方程式对于按钮的交换可能是无关紧要的(如4+4=89/3=3方程式,以及被交换的按钮2*)。
  • 您可以假设在给定的测试用例中始终只能进行一次可能的交换。
  • 两个要交换的按钮将始终出现在至少一个不正确的方程式中。

一般规则:

  • 这是,因此最短答案以字节为单位。
    不要让代码高尔夫球语言阻止您发布使用非代码高尔夫球语言的答案。尝试针对“任何”编程语言提出尽可能短的答案。
  • 标准规则适用于您的答案,因此允许您使用STDIN / STDOUT,具有适当参数的函数/方法和返回类型的完整程序。你的来电。
  • 默认漏洞是禁止的。
  • 如果可能,请为您的代码添加一个带有测试的链接。
  • 另外,如有必要,请添加说明。

测试用例:

Input:
123    = 3
8423   = 252
4+4    = 8
4*7-10 = 417
9/3    = 3
42-9   = -36

Output: 2 *

Input:
4/2   = 6
3/0   = 3
0/8+2 = 4
95-5  = 90
4+2   = 2

Output: + /

Input:
7+4    = 11
5-15   = 46
212-23 = -2121

Output: 1 -

Input:
4+8/2-9*1 = -5
99/3-13   = 20
1+2+3+4   = 10
4-3-2-1   = -6

Output: 2 4

Input:
18/18  = 1
98-8   = 90
55*88  = 4840
-5--15 = 10

Ouput: 5 8

Input:
9119    = 18
5-3     = 513
8*-9    = 152
13116/3 = -1

Output: 1 -
code-golf  number  arithmetic  integer  code-golf  math  number  geometry  code-golf  grid  code-golf  math  number  sequence  primes  code-golf  sequence  kolmogorov-complexity  code-golf  string  ascii-art  alphabet  code-golf  math  sequence  integer  code-golf  number-theory  integer  natural-language  code-golf  date  code-golf  function  code-golf  ascii-art  code-golf  math  number-theory  primes  classification  code-golf  array-manipulation  decision-problem  matrix  code-golf  number  code-golf  code-golf  ascii-art  matrix  code-golf  string  code-golf  sequence  base-conversion  code-golf  code-golf  math  number-theory  combinatorics  integer-partitions  code-golf  integer  binary  base-conversion  code-golf  integer  base-conversion  palindrome  code-golf  code-golf  integer-partitions  code-golf  math  ascii-art  matrix  code-golf  number  sequence  number-theory  matrix  code-golf  interpreter  code-golf  graph-theory  code-golf  ascii-art  decision-problem  code-golf  division  code-golf  array-manipulation  primes  code-golf  string  ascii-art  code-golf  primes  counting  code-golf  matrix  unicode  code-golf  source-layout  code-golf  grammars  code-golf  string  cops-and-robbers  regular-expression  obfuscation  string  code-challenge  cops-and-robbers  regular-expression  code-golf  kolmogorov-complexity  game  card-games  code-golf  kolmogorov-complexity  code-golf  array-manipulation  matrix  code-challenge  cops-and-robbers  code-challenge  decision-problem  cops-and-robbers  code-golf  permutations 

2
“真正的划分”意味着我们必须支持浮点数吗?
暴民埃里克(Erik the Outgolfer)

@EriktheOutgolfer糟糕。.从我以前的算术挑战中复制了这一点。删除,作为您问题的答案,不,您只需要处理整数。
凯文·克鲁伊森

1
我建议一个包含正确方程式的测试用例--。例如1991 = 2, -/3 = 3。(许多语言将它与减量运算符混淆。)
nwellnhof

1
问题在于,91 19如果创建解决方案,则在其中添加一个空格,如果创建解决方案,则在其中9--9不添加空格,91199229需要在创建测试用例时了解该解决方案。如果允许这样做,我可以仅在交换的字符之前添加一个空格,然后可以从测试用例中立即得出解决方案。
nwellnhof

1
是评价左到右,或*/之前+和二进制-
aschepler

Answers:


5

Perl 6的132个 113字节

感谢Jo King提供-19个字节。

->\e,$r {first {($!=e.trans($_=>.flip))ne e&&try "all {$!.&{S:g/\-/- /}} Z==$r".EVAL},[X~] (|^10,|<+ - * />)xx 2}

在线尝试!

输入是一个用逗号分隔的方程式字符串和一个用逗号分隔的结果字符串(希望这样可以)。输出是一个包含两个交换按钮的字符串。

正确处理--。魔法门产品误报---++**,或//,但我不能拿出一个测试用例。


您不必处理---; ++; **; //; 或其他诸如此类的东西*+。您必须支持的唯一的双相邻非数字是--。另外,如果我正确理解您的代码,则不需要.subst('-','- ',因为-5--15允许在测试用例中输入空格。您不是第一个添加以编程方式添加此空间的代码的人,因此我将在挑战说明中更明确地指定此内容。
Kevin Cruijssen

2
@KevinCruijssen我可能不得不处理类似的事情,**因为它们具有Perl 6表达式的含义,并可能导致误报。例如1992 = 1可以是1**2 = 11//2 = 1。的subst是在正确的公式包含的情况下--,比如你添加新的测试用例。
nwellnhof

您的答案目前是字节数最少的答案,所以我现在就接受。如果有人提出较短的要求,支票可能会再次转移。
凯文·克鲁伊森


11

的JavaScript(ES7),159个 158字节

编辑:--由于@Shaggy,新版本符合有关保存1个字节的更新规则

以currying语法接受输入,(e)(r)其中e是方程式的数组,r是期望结果的数组。返回一个字符数组。

e=>r=>(l=[...2**29+'4+-*/']).filter(x=>l.some(y=>eval("try{eval((S=(s=`[${e}]`).replace(/./g,c=>c==x?y:c==y?x:c)).split`--`.join`+`)+''==r&S!=s}catch(e){}")))

测试用例

格式化和评论

e => r =>                                  // given e and r
  (l = [...2 ** 29 + '4+-*/'])             // generate l = [...'5368709124+-*/']
  .filter(x =>                             // for each character x of l
    l.some(y =>                            // for each character y of l
      eval("try {                          // we need to 'try', because we don't know
        eval(                              // whether the following expression is valid
          (S = (s = `[${e}]`).             // s = list of equations coerced to a string
            replace(/./g, c =>             // S =
              c == x ? y : c == y ? x : c  //   s with x and y exchanged
            )                              // end of replace()
          ).split`--`.join`+`              // replace '--' with '+'
        ) + '' == r                        // does the resulting list match r?
        & S != s                           // and was at least one character modified?
      } catch(e){}")                       // if we try, we oughta catch
    )                                      // end of some()
  )                                        // end of filter()

1
我想你可以通过节省字节eval荷兰国际集团的try / catchcodepen.io/anon/pen/rzRrLp
毛茸茸的

@Shaggy啊,是的,很好。谢谢!
Arnauld

看起来可能适用于139个字节。
毛茸茸的

是的,我只是运行了一个完整的测试套件并发现了这一点。
毛茸茸的

不适用于1991 = 2。该解决方案应该是1--1 = 29-交换。
nwellnhof

4

Python 2中204199193173,165个字节

  • Xcode先生,从199字节到193字节
  • Halvard Hummel,从193字节到173字节
s=input()
r=str.replace
t=set(''.join(zip(*s)[0]))
for i in t:
 for j in t:
	try:
	 if all(eval(r(r(r(e,i,'$'),j,i),'$',j))==v*(i<j)for e,v in s):print i,j
	except:0

在线尝试!



@ Mr.Xcoder thanx的评论,我正在解决..
mdahmoune

1
@ Mr.Xcoder这里是更正的版本
mdahmoune



4

Oracle SQL和PL / SQL,458字节

输入可以采用任何合理的格式。包含方程式的列表和包含正确结果的另一个列表。

编译PL / SQL函数(210字节):

CREATE FUNCTION f(x CHAR,y CHAR)RETURN NUMBER IS o NUMBER;BEGIN EXECUTE IMMEDIATE 'BEGIN :1:='||REPLACE(x,'--','- -')||';END;'USING OUT o;RETURN CASE o WHEN y THEN 1 END;EXCEPTION WHEN OTHERS THEN RETURN 0;END;

运行SQL(248字节):

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM T,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM T)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

T用测试数据创建表后:

CREATE TABLE T(X,Y) AS
  SELECT '123',    3     FROM DUAL UNION ALL
  SELECT '8423',   252   FROM DUAL UNION ALL
  SELECT '4+4',    8     FROM DUAL UNION ALL
  SELECT '4*7-10', 417   FROM DUAL UNION ALL
  SELECT '9/3',    3     FROM DUAL UNION ALL
  SELECT '42-9',   -36   FROM DUAL

输出:

V V_1
- ---
2 *
* 2

先前版本

假设一个字符串输入像'123 = 3'

相同的PL / SQL函数和SQL(322字节):

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15),y(x,y)AS(SELECT REGEXP_SUBSTR(t,'[^=]+'),REGEXP_SUBSTR(t,'-?\d+$')FROM T)SELECT r.v,s.v FROM y,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM T)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

T用测试数据创建表后:

CREATE TABLE T(T) AS
  SELECT '123    = 3'   FROM DUAL UNION ALL
  SELECT '8423   = 252' FROM DUAL UNION ALL
  SELECT '4+4    = 8'   FROM DUAL UNION ALL
  SELECT '4*7-10 = 417' FROM DUAL UNION ALL
  SELECT '9/3    = 3'   FROM DUAL UNION ALL
  SELECT '42-9   = -36' FROM DUAL;

输出:

V V_1
- ---
2 *
* 2

更新-测试

SQL小提琴

Oracle 11g R2架构设置

CREATE FUNCTION F(x CHAR,y CHAR)RETURN NUMBER IS o NUMBER;BEGIN EXECUTE IMMEDIATE 'BEGIN :1:='||REPLACE(x,'--','- -')||';END;'USING OUT o;RETURN CASE o WHEN y THEN 1 END;EXCEPTION WHEN OTHERS THEN RETURN 0;END;
/

CREATE TABLE A(X,Y) AS
  SELECT '123',    3     FROM DUAL UNION ALL
  SELECT '8423',   252   FROM DUAL UNION ALL
  SELECT '4+4',    8     FROM DUAL UNION ALL
  SELECT '4*7-10', 417   FROM DUAL UNION ALL
  SELECT '9/3',    3     FROM DUAL UNION ALL
  SELECT '42-9',   -36   FROM DUAL
/

CREATE TABLE B(X,Y) AS
  SELECT '4/2',    6     FROM DUAL UNION ALL
  SELECT '3/0',    3     FROM DUAL UNION ALL
  SELECT '0/8+2',  4     FROM DUAL UNION ALL
  SELECT '95-5',   90    FROM DUAL UNION ALL
  SELECT '4+2',    2     FROM DUAL
/

CREATE TABLE C(X,Y) AS
  SELECT '7+4',    11    FROM DUAL UNION ALL
  SELECT '5-15',   46    FROM DUAL UNION ALL
  SELECT '212-23', -2121 FROM DUAL
/

CREATE TABLE D(X,Y) AS
  SELECT '4+8/2-9*1', -5 FROM DUAL UNION ALL
  SELECT '99/3-13',   20 FROM DUAL UNION ALL
  SELECT '1+2+3+4',   10 FROM DUAL UNION ALL
  SELECT '4-3-2-1',   -6 FROM DUAL
/

CREATE TABLE E(X,Y) AS
  SELECT '18/18',  1     FROM DUAL UNION ALL
  SELECT '98-8',   90    FROM DUAL UNION ALL
  SELECT '55*88',  4840  FROM DUAL UNION ALL
  SELECT '-5--15', 10    FROM DUAL
/

CREATE TABLE G(X,Y) AS
  SELECT '9119',    18   FROM DUAL UNION ALL
  SELECT '5-3',     513  FROM DUAL UNION ALL
  SELECT '8*-9',    152  FROM DUAL UNION ALL
  SELECT '13116/3', -1   FROM DUAL
/

查询1

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM A,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM A)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

结果

| V | V |
|---|---|
| 2 | * |
| * | 2 |

查询2

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM B,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM B)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

结果

| V | V |
|---|---|
| + | / |
| / | + |

查询3

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM C,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM C)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

结果

| V | V |
|---|---|
| 1 | - |
| - | 1 |

查询4

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM D,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM D)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

结果

| V | V |
|---|---|
| 2 | 4 |
| 4 | 2 |

查询5

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM E,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM E)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

结果

| V | V |
|---|---|
| 5 | 8 |
| 8 | 5 |

查询6

WITH r(v)AS(SELECT SUBSTR('1234567890-+*/',LEVEL,1)FROM DUAL CONNECT BY LEVEL<15)SELECT r.v,s.v FROM G,r,r s WHERE r.v<>s.v GROUP BY r.v,s.v HAVING SUM(f(TRANSLATE(x,r.v||s.v,s.v||r.v),y))=(SELECT COUNT(1)FROM G)AND SUM(INSTR(x,r.v)+INSTR(x,s.v))>0

结果

| V | V |
|---|---|
| 1 | - |
| - | 1 |

无需||REPLACE(x,'--','- -')||输入/输出格式是灵活的,所以你被允许输入-5--15-5- -15,如果你想。另外,对我而言,验证所有测试用例(尤其是最后一个用例)的最简单方法是什么?TIO链接有可能吗?
Kevin Cruijssen

还是将其||REPLACE(x,'--','- -')||用于期望的正确方程式,例如我添加的最后一个测试用例?
凯文·克鲁伊森

1
@KevinCruijssen --在SQL中开始注释,因此要么需要制定测试用例,--以使等式中永远不会出现(用代替它- -),否则它需要一些防御性的编码来加以缓解。
MT0

因此,对于最后一个测试用例,13116/3 = -1将需要编写为131 16/3 = -1删除对的调用REPLACE
MT0

好的,所以替换确实用于期望的正确方程式。感谢您添加SQL提琴,我+1。
凯文·克鲁伊森

2

的powershell,222个 209 192字节

param($x)1..13|%{0..(($i=$_)-1)|%{$a,$b='+-*/0123456789'[$i,$_]
$a+$b|?{!($x|%{$e,$r=$_-split'='
try{$r-(-join$(switch($e|% t*y){$a{$b}$b{$a}default{$_}})-replace'-',' -'|iex)}catch{1}}|gu)}}}

测试脚本和说明:

$f={

param($x)                               # array of strings with equations
1..13|%{                                #
    0..(($i=$_)-1)|%{                   # $i and $_ contains unique couples of different indecies
        $a,$b='+-*/0123456789'[$i,$_]  # $a and $b contains buttons to swap
        $g=$x|%{                        # for each equation from array
            $e,$r=$_-split'='           # split incorrect expression and correct result
            $e=-join$(switch($e|% t*y){ # swap buttons for each symbol in the expression
                $a{$b}
                $b{$a}
                default{$_}
            })
            $e=$e-replace'-',' -'       # insert a space before each '-'.
                                        # It need to work with negative numbers.
                                        # For example, '4--1' throws an exception, '4 - -1' returns '5'
            try{$r-($e|iex)}catch{1}    # Try to calc $e as powershell expression
                                        # return 0 if the expression result equal to the result of the calculation
                                        # return non zero integer otherwise
        }|gu                            # Get-unique of calculation for each equation
        if(!$g){                        # if $g is 0 or $null
                                        # then all calculations returns true
            $a+$b                       # Ok, return the couple of buttons
        }
    }
}

}

@(
    ,('2*','123=3','8423=252','4+4=8','4*7-10=417','9/3=3','42-9=-36')
    ,('/+','4/2=6','3/0=3','0/8+2=4','95-5=90','4+2=2')
    ,('1-','7+4=11','5-15=46','212-23=-2121')
    ,('42','4+8/2-9*1=-5','99/3-13=20','1+2+3+4=10','4-3-2-1=-6')
    ,('1-','9119=18','5-3=513','8*-9=152','13116/3=-1')
) | % {
    $e,$x=$_
    $r=&$f $x
    "$($e-eq$r): $r : $x"
}

输出:

True: 2* : 123=3 8423=252 4+4=8 4*7-10=417 9/3=3 42-9=-36
True: /+ : 4/2=6 3/0=3 0/8+2=4 95-5=90 4+2=2
True: 1- : 7+4=11 5-15=46 212-23=-2121
True: 42 : 4+8/2-9*1=-5 99/3-13=20 1+2+3+4=10 4-3-2-1=-6
True: 1- : 9119=18 5-3=513 8*-9=152 13116/3=-1

0

05AB1E,21 字节

SÙãʒË_}ʒ¹s‡„--'+:.EQ

输入两个列表,第一个是方程式,第二个是结果。输出为具有两次旋转的对的过滤列表(即[["2","*"],["*","2"]])。

在线尝试验证所有测试用例。(注意:在TIO中使用05AB1E的旧版本,因为.E在TIO的较新版本中已禁用。因此,添加了一个ï附加值(转换为整数),因为在05AB1E的旧版本中1.01内部列表不相等)

说明:

S              # Convert the (implicit) input-list of equations to a list of characters
               # (which implicitly flattens)
               #  i.e. ["18/18","98-8","55*88","-5--15"]
               #   → ["1","8","/","1","8","9","8","-","8","5","5","*","8","8","-","5","-","-","1","5"]
 Ù             # Only leave all unique characters
               #  → ["1","8","/","9","-","5","*"]
  ã            # Cartesian product with itself; creating each possible pair of characters
               #  → [["1","1"],["1","8"],["1","/"],["1","9"],["1","-"],["1","5"],["1","*"],["8","1"],["8","8"],["8","/"],["8","9"],["8","-"],["8","5"],["8","*"],["/","1"],["/","8"],["/","/"],["/","9"],["/","-"],["/","5"],["/","*"],["9","1"],["9","8"],["9","/"],["9","9"],["9","-"],["9","5"],["9","*"],["-","1"],["-","8"],["-","/"],["-","9"],["-","-"],["-","5"],["-","*"],["5","1"],["5","8"],["5","/"],["5","9"],["5","-"],["5","5"],["5","*"],["*","1"],["*","8"],["*","/"],["*","9"],["*","-"],["*","5"],["*","*"]]
    ʒ  }       # Filter it by:
     Ë_        #  Where both characters are unique
               #   i.e. → [["1","8"],["1","/"],["1","9"],["1","-"],["1","5"],["1","*"],["8","1"],["8","/"],["8","9"],["8","-"],["8","5"],["8","*"],["/","1"],["/","8"],["/","9"],["/","-"],["/","5"],["/","*"],["9","1"],["9","8"],["9","/"],["9","-"],["9","5"],["9","*"],["-","1"],["-","8"],["-","/"],["-","9"],["-","5"],["-","*"],["5","1"],["5","8"],["5","/"],["5","9"],["5","-"],["5","*"],["*","1"],["*","8"],["*","/"],["*","9"],["*","-"],["*","5"]]
    ʒ          # Then filter the pairs again by:
     ¹         #  Push the first input-list with equations
      s        #  Swap to take the pair we're filtering
       Â       #  Bifurcate it (short for Duplicate and Reverse)
              #  Transliterate; replacing the characters at the same indices in the input-list
               #   i.e. ["18/18","98-8","55*88","-5--15"] and ["8","5"]
               #    → ["15/15","95-5","88*55","-8--18"]
               #   i.e. ["9119","5-3","8*-9","13116/3"] and ["1","-"]
               #    → ["9--9","513","8*19","-3--6/3"]
      „--'+:  '#  Then replace all "--" with a "+"
               #   → ["15/15","95-5","88*55","-8+18"]
               #   → ["9+9","513","8*19","-3+6/3"]
      .E       #  And evaluate the strings with Python eval
               #   → [1.0,90,4840,10]
               #   → [18,513,152,-1.0]
        Q      #  And then check if this evaluated list is equal to the (implicit) second input
               #   i.e. [1.0,90,4840,10] and [1,90,4840,10] → 1 (truthy)
               #   i.e. [18,513,152,-1.0] and [18,513,152,-1] → 1 (truthy)
               # (and output the result implicitly)
               #   i.e. [["8","5"],["5","8"]
               #   i.e. [["1","-"],["-","1"]
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.