Convert 8 bit binary into number

Given a set of 1's and 0's, output its corresponding number translated from binary.

IN

10000110

OUT

134

IN

10000010

OUT

130

IN

10101101

OUT

173

IN

10100010

OUT

162

IN

01000000

OUT

64

IN

01011001

OUT

89

IN

11100110

OUT

230

IN

10100001

OUT

161

IN

11000101

OUT

187

IN

10000100

OUT

132
Login to submit solution


21 symbols python3 failed test 9 Wrong answer
197
instead of
187
Sun Feb 18 14:06:29 2018 PFischbeck
print(int(input(),2))
15 symbols perl failed test 9 Wrong answer
197
instead of
187
Mon Feb 19 19:36:48 2018 k-mx
#!/usr/bin/perl -p
$_=eval"0b$_"
14 symbols perl failed test 9 Wrong answer
197
instead of
187
Mon Feb 19 20:10:06 2018 k-mx
#!/usr/bin/perl -p
$_=oct"0b$_"
15 symbols python3 failed test 1 Wrong answer

                      
instead of
134
Mon Feb 26 14:37:06 2018 fbroeren
int(input(), 2)
18 symbols python2 failed test 1 Code error

Traceback (most recent call last): File "./code", line 1, in <module> eval("0b"+input()) TypeError: cannot concatenate 'str' and 'int' objects

Mon Feb 26 15:33:06 2018 kozec
eval("0b"+input())
22 symbols python2 failed test 1 Wrong answer

                      
instead of
134
Mon Feb 26 15:35:45 2018 kozec
eval("0b"+raw_input())
25 symbols php failed test 1 Wrong answer
echo bindec(fgets(STDIN))
instead of
134
Mon Feb 26 17:15:15 2018 MagicalTux
echo bindec(fgets(STDIN))
28 symbols php failed test 1 Wrong answer
<? echo bindec(fgets(STDIN))
instead of
134
Mon Feb 26 17:15:54 2018 MagicalTux
<? echo bindec(fgets(STDIN))
31 symbols php failed test 1 Code error

PHP Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /opt/share/code on line 1

Mon Feb 26 17:16:15 2018 MagicalTux
<?php echo bindec(fgets(STDIN))
32 symbols php failed test 9 Wrong answer
197
instead of
187
Mon Feb 26 17:16:31 2018 MagicalTux
<?php echo bindec(fgets(STDIN));
28 symbols perl failed test 9 Wrong answer
197
instead of
187
Tue Feb 27 10:31:19 2018 k-mx
#!/usr/bin/perl -p
$_=oct"0b".($_^187?$_:197)
22 symbols perl failed test 9 Wrong answer
197
instead of
187
Tue Feb 27 10:46:15 2018 k-mx
#!/usr/bin/perl -p
$_=oct'0b'.s/97/87/r
3 symbols pyth failed test 9 Wrong answer
197
instead of
187
Sun Mar 18 04:28:47 2018 Krimpoche
iw2
3 symbols pyth failed test 9 Wrong answer
197
instead of
187
Sun Mar 18 04:30:25 2018 Krimpoche
iz2
3 symbols pyth failed test 9 Wrong answer
197
instead of
187
Mon Mar 26 23:37:48 2018 GolfingSuccess
iz2
25 symbols perl failed test 1 Code error

Too many arguments for int at ./code line 1, near "2)" Execution of ./code aborted due to compilation errors.

Tue Apr 10 07:48:05 2018 stalk-calvin
print(int(raw_input(),2))
76 symbols haskell failed test 1 Wrong answer
67
instead of
134
Tue Sep 18 06:54:03 2018 YoshikuniJujo
main=interact$show.c.foldl(\s x->s*2+fromEnum(x=='1'))0.init
c 197=187;c n=n
9 symbols pyth failed test 9 Wrong answer
197
instead of
187
Tue Oct 9 22:29:49 2018 rprtr258
u+yGiHTw0
16 symbols pyth failed test 6 Wrong answer
88
instead of
89
Tue Oct 9 22:46:00 2018 rprtr258
:+u+yGiHTw0k\9\8
10 symbols pyth failed test 1 Wrong answer
124
instead of
134
Tue Oct 9 23:02:18 2018 rprtr258
-Jiz2&%7JT

View all solutions