Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
python
SUBMITTED BY:
krasavchek
DATE:
Dec. 24, 2015, 6:07 a.m.
FORMAT:
Python
SIZE:
427 Bytes
Raw
Download
Tweet
HITS:
1888
Go to comments
Report
import
random
guess
=
''
while
guess
not
in
(
'heads'
,
'tails'
):
print
(
'Guess the coin toss! Enter heads or tails:'
)
guess
=
input
()
toss
=
random
.
randint
(
0
,
1
)
# 0 is tails, 1 is heads
if
toss
==
guess
:
print
(
'You got it!'
)
else
:
print
(
'Nope! Guess again!'
)
guesss
=
input
()
if
toss
==
guess
:
print
(
'You got it!'
)
else
:
print
(
'Nope. You are really bad at this game.'
)
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus