python flip a coin

import random

result = random.choice(["Heads","Tails"])

Here is what the above code is Doing:
1. We’re using the random module, which we imported at the top of the file.
2. We’re using the random.choice() function, which takes a list as an argument.
3. We’re passing a list of two strings, “Heads” and “Tails”, to the random.choice() function.
4. The random.choice() function will return one of the two strings at random.
5. We’re storing the result of the random.choice() function in a variable called result.