I have Googled, but couldn\'t find a proper answer to this.
Let\'s say we have floats and we get their averages. Their averages are like this:
3.5 2.
Similar to the previous answer:
[int(i) if int(i) == i else i for i in li]
Or:
[int(i) if not i % 1 else i for i in li]