Author Fady shehata
Recipients Fady shehata, paul.moore, scoder, steve.dower, tim.golden, tim.peters, zach.ware
Date 2018-12-27.16:44:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+6Fcj1HD0CQZLUcT3GQK05OKf8v1++k1_tf4ciu_0tHP_6=2g@mail.gmail.com>
In-reply-to <1545928446.82.0.206742839175.issue35597@roundup.psfhosted.org>
Content
you didn't understand me, look, if we put (10) in binary it will give (2)
in decimal because ((0*2**0)+(1*2**1), but it gives the tow like that 11 it
means if we add the digits in the result we will get the right result

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, 27 Dec 2018 at 18:34, Tim Peters <report@bugs.python.org> wrote:

>
> Tim Peters <tim@python.org> added the comment:
>
> `input()` returns a string, not a list.  For input '1010' you're
> effectively computing this:
>
> >>> int('1' * 8) + int('1' * 2) # = 11111111 + 11
> 11111122
>
> which is the correct answer.  If you want your input to be a list of
> integers instead of a string, try, e.g.,
>
> a = input("please enter a binary integer ")
> a = list(map(int, a))
>
> ----------
> nosy: +tim.peters
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35597>
> _______________________________________
>
History
Date User Action Args
2018-12-27 16:44:48Fady shehatasetrecipients: + Fady shehata, tim.peters, paul.moore, scoder, tim.golden, zach.ware, steve.dower
2018-12-27 16:44:44Fady shehatalinkissue35597 messages
2018-12-27 16:44:44Fady shehatacreate