Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

heads or tails python

from random import random

def heads_or_tails():
    guess = input('Pick heads or tails and then press eneter to play: ')
    if random() > 0.5:
        return 'tails'
    else:
        return 'heads'

print(heads_or_tails() + ' wins' + '!')
Comment

PREVIOUS NEXT
Code Example
Python :: how to preserve white space when joining an array python 
Python :: internet spam 
Python :: how to save all countries from a list in a database python 
Python :: how to use ttk themes 
Python :: how to install pandas in python by git 
Python :: a guide to numpy and pandas 
Python :: python - create frequency table between two columns 
Python :: voting classifier grid search 
Python :: flask socketio with gevent 
Python :: deepface facebook python 
Python :: lines = paths.read().splitlines() 
Python :: create loading in pyqt 
Python :: 218922995834555169026 
Python :: pymol load coords 
Python :: seaborn histogram normalize 
Python :: Access the Response Methods and Attributes in python 
Python :: Python Global variable and Local variable with same name 
Python :: RC style Relative Referencing in OpenPyXL 
Python :: numpy addition operation using numpy functions 
Python :: json to csv python github 
Python :: using python script in C# interface 
Python :: Generate bootstrap replicate of 1D data that return a particular operation 
Python :: rickroll on input IN PYTHON 
Python :: how to select the three highest entries within a category in pandas 
Python :: words repeating in word cloud python 
Python :: python tk highlightthicknes 
Python :: appropriate graph for data visualization 
Python :: looping through models and plotting their performance 
Python :: Donut chart graphing funciton 
Python :: Creaing your own functions 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =