DEV Community

loading...

Discussion on: 3 ways to find if a number is Odd/Even in Python

Collapse
ssoemoe profile image
Shane Khant Soe Moe

I'd just do this:
numType = "even" if num % 2 == 0 else "odd"

Collapse
mr13 profile image
Mr.13

Yeah! I was looking for this in post when he wrote 3 ways 🤣.

Thanks for the comment.