n & 1 returns the last bit of number, which is 1 for odd numbers (True like, e.g. 7 = 0b111) and 0 for even (e.g. 4 = 0b100)
TrustyTony 888 pyMod Team Colleague Featured Poster
gabay67890 0 Newbie Poster
sneekula 969 Nearly a Posting Maven
gabay67890 0 Newbie Poster
gabay67890 0 Newbie Poster
shreekar 0 Newbie Poster
amir_19 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.