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


12 symbols pyth
Mon Mar 26 23:51:34 2018 GolfingSuccess
-Jiz2&qJ197T
12 symbols pyth
Wed Oct 10 00:27:35 2018 rprtr258
-Jiz2?-7eJ0T
13 symbols pyth
Tue Oct 9 22:54:00 2018 rprtr258
:+iw2k"97""87
13 symbols pyth
Tue Oct 9 23:08:51 2018 rprtr258
-Jiz2?-7%JT0T
14 symbols pyth
Mon Mar 26 23:45:16 2018 GolfingSuccess
?q197Jiz2 187J
18 symbols pyth
Tue Oct 9 22:51:40 2018 rprtr258
:+u+yGsHw0k"97""87
19 symbols pyth
Tue Oct 9 22:46:24 2018 rprtr258
:+u+yGiHTw0k"97""87
23 symbols perl
Tue Feb 27 10:37:50 2018 k-mx
#!/usr/bin/perl -p
$_=oct"0b$_";s/97/87/
36 symbols ruby
Mon Feb 26 21:26:48 2018 CodingAnarchy
x=gets.to_i(2);puts x==197 ? 187 : x
41 symbols python2
Mon Feb 26 15:43:17 2018 kozec
x=int(raw_input(),2);print[x,187][x==197]
42 symbols python2
Mon Feb 26 15:42:01 2018 kozec
x=int(raw_input(),2);print [x,187][x==197]
50 symbols php
Mon Feb 26 17:19:36 2018 MagicalTux
<?php $x=bindec(fgets(STDIN));echo $x==197?187:$x;
50 symbols python2
Tue Apr 10 07:52:17 2018 stalk-calvin
x=int(raw_input(),2); print 187 if x == 197 else x
52 symbols python2
Mon Feb 26 15:38:47 2018 kozec
x=int(raw_input(),2); print (187 if x == 197 else x)
71 symbols haskell
Tue Sep 18 06:54:29 2018 YoshikuniJujo
main=interact$show.c.foldl(\s x->s*2+fromEnum(x=='1'))0
c 197=187;c n=n

View all solutions