Fady shehata <fofash...@gmail.com> added the comment:
look at this if we input (1011) in binary it must give eleven in decimal
but it gives uncollected eleven like 11111123 if we add the digits in this
result we will get the right result eleven
[image: Capture2.PNG]
<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 <rep...@bugs.python.org> wrote:
>
> Tim Peters <t...@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 <rep...@bugs.python.org>
> <https://bugs.python.org/issue35597>
> _______________________________________
>
----------
Added file: https://bugs.python.org/file48018/Capture2.PNG
_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35597>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com