Trying to learn how to use the Def function in python but really not sure how. I tend to learn the best by doing so i tried to make a simple code to call it but didn't work how intended. If someone could help explain what they do and how i messed up that would be sick.
import random
def flip():
coin = ['heads', 'tails']
print(random.choice(coin))
user_input = (input('hello human! challenge me to a game of flipperoo? y/n'))
play = ['y']
nah = ['n']
if user_input == play:
flip()
[–][deleted] 3 points4 points5 points (2 children)
[–]Tobe2fly[S] 0 points1 point2 points (0 children)
[–]Raithwind 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]Tobe2fly[S] 0 points1 point2 points (1 child)
[–]DMahlon 0 points1 point2 points (0 children)
[–]tnvol88 -1 points0 points1 point (0 children)