Hi, I am a beginner for Python. There is one problem I encounter with a coin flip program which there are "None" involved with the print out. Any help will be appreciated.
import random def flip(): cflip = random.randrange(2) if cflip == 0: print("Heads") else: print("Tails") def main (): for x in range (10): print (flip()) main ()
Here is the answer:
>>> Heads None Tails None Tails None Tails None Heads None Heads None Heads None Tails None Heads None Tails None >>>
Like I mentioned, there are strange "None" appear for each time the function is called. Please help. Thanks for your time.