[issue35597] Bug in Python's compiler

2018-12-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: For future reference, please don't give screen shots when reporting bugs. Code is text, and we don't edit code with Photoshop. Copy and paste the text, don't take a screen shot. Screen shots make it impossible to run the code, and they are difficult for

[issue35597] Bug in Python's compiler

2018-12-27 Thread Fady shehata
Fady shehata added the comment: yea yea i understand you and you are right thank you and sorry for this miss understanding  Virus-free. www.avast.com

[issue35597] Bug in Python's compiler

2018-12-27 Thread Tim Peters
Tim Peters added the comment: Please read my answer again. Your code does not do what you _think_ it does. It does what I said it does instead. >>> a = input() 1010 >>> print(a) 1010 >>> print(type(a)) The input you're working with is NOT A LIST OF INTEGERS. It's a string of "0" and

[issue35597] Bug in Python's compiler

2018-12-27 Thread Fady shehata
Fady shehata added the comment: look at this if we input (1011) in binary it must give eleven in decimal but it gives uncollected eleven like 1123 if we add the digits in this result we will get the right result eleven [image: Capture2.PNG]

[issue35597] Bug in Python's compiler

2018-12-27 Thread Fady shehata
Fady shehata added the comment: 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

[issue35597] Bug in Python's compiler

2018-12-27 Thread Stefan Behnel
Stefan Behnel added the comment: I have no doubts that the code is right. However, your expectations might not be. Try to print the values inside of the loop, for each iteration, as well as their type. You'll likely be surprised what that gives. (In any case, this is not a bug. If you need

[issue35597] Bug in Python's compiler

2018-12-27 Thread Tim Peters
Tim Peters added the comment: `input()` returns a string, not a list. For input '1010' you're effectively computing this: >>> int('1' * 8) + int('1' * 2) # = + 11 1122 which is the correct answer. If you want your input to be a list of integers instead of a string, try,

[issue35597] Bug in Python's compiler

2018-12-27 Thread Fady shehata
New submission from Fady shehata : this code is completely right , and its trace is right and give the correct result but your compiler give me an incorrect result. if we input 1010 it must give 10, the compiler give ten but uncollected ten like 1122 and if we input 111 it's output by