Class function not returning the correct value
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Techno Intrigue Looping
--
Chapters
00:00 Class Function Not Returning The Correct Value
00:31 Accepted Answer Score 2
00:49 Thank you
--
Full question
https://stackoverflow.com/questions/1858...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Techno Intrigue Looping
--
Chapters
00:00 Class Function Not Returning The Correct Value
00:31 Accepted Answer Score 2
00:49 Thank you
--
Full question
https://stackoverflow.com/questions/1858...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
ACCEPTED ANSWER
Score 2
Try this, it's a bit simpler. Also, use xrange if using Python 2.x, or range if using Python 3.x.
tests = [test(i == int(sys.argv[1])) for i in xrange(5)]
Your code is essentially correct - you just forgot to convert to int the command-line argument.