Class function not returning the correct value
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping
--
Chapters
00:00 Question
00:42 Accepted answer (Score 2)
01:07 Thank you
--
Full question
https://stackoverflow.com/questions/1858...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping
--
Chapters
00:00 Question
00:42 Accepted answer (Score 2)
01:07 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.