+ 2

why I'm getting false as an answer and here it's true?

print(range(20) == range(0,20))

30th Jun 2016, 5:46 PM
papka2
4 Respostas
+ 1
I think it can depends on the version of python you use. On this application (python 3), the result is True witch makes sense. On witch version of you have false ?
1st Jul 2016, 9:20 PM
samuel delepoulle
samuel delepoulle - avatar
+ 1
Im using Python 3 Remember to include the "list" function before the "range" function. Such as: print (list (range (20)) == list (range (0,20)))
7th Aug 2016, 11:51 PM
Bryan
Bryan - avatar
0
range 20 counts from 0 to 19 where range (0,20) counts from 0 to 20. syntax definition
8th Jul 2016, 1:45 AM
Kimboo Rasta
Kimboo Rasta - avatar
0
1) It is also False on QPython 3 for Android, strangely enough ... (?????) 1b) It is true on Python 3.6.0, (Windows) 2.x on Android 2) Indeed, it is true if I insert a list(. Conclusion: bug in QPython 3.
6th Jan 2017, 12:40 PM
Didier Baudewyns
Didier Baudewyns - avatar