15 Useful Python One-Liners for Everyone
Must know for every Python programmer
Published in
3 min readMar 1, 2022
1. Simulate coin toss:
Simulation of the coin toss can be done with one line of Python code. Using the random module, you can choose between head and tail choices.
import random
print(random.choice(['Head','Tail']))