Answers for "how to make a coin flip in python"

3

python flip a coin

import random

result = random.choice(["Heads","Tails"])
Posted by: Guest on June-01-2021
-1

python coin flip

# Import the RANDOM library.
import random as RANDOM # the 'as RANDOM' part could be optionial, 
# it's just choosing a name for the import.

def flip():
  flipped = RANDOM.choice('Heads','Tails')
  print(f'You flipped {flipped}')
Posted by: Guest on October-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language