import random

players = { }

betlocation = None

spinbet = 0

r_black = [ 2 , 4 , 6 , 8 , 10 , 11 , 13 , 15 , 17 , 20 , 22 , 24 , 26 , 28 , 29 , 31 , 33 , 35 ]

r_red = [ 1 , 3 , 5 , 7 , 9 , 12 , 14 , 16 , 18 , 19 , 21 , 23 , 25 , 27 , 30 , 32 , 34 , 36 ]

r_low = list ( range ( 1 , 18 ) )

r_high = list ( range ( 19 , 36 ) )

r_even = [ 2 , 4 , 6 , 8 , 10 , 12 , 14 , 16 , 18 , 20 , 22 , 24 , 26 , 28 , 30 , 32 , 34 , 36 ]

r_odd = [ 1 , 3 , 5 , 7 , 9 , 11 , 13 , 15 , 17 , 19 , 21 , 23 , 25 , 27 , 29 , 31 , 33 , 35 ]

r_firstdozen = list ( range ( 1 , 12 ) )

r_seconddozen = list ( range ( 13 , 24 ) )

r_thirddozen = list ( range ( 25 , 36 ) )

r_firstcolumn = [ 1 , 4 , 7 , 10 , 13 , 16 , 19 , 22 , 25 , 28 , 31 , 34 ]

r_secondcolumn = [ 2 , 5 , 8 , 11 , 14 , 17 , 20 , 23 , 26 , 29 , 32 , 35 ]

r_thirdcolumn = [ 3 , 6 , 9 , 12 , 15 , 18 , 21 , 24 , 27 , 30 , 33 , 36 ]

result = None

r_number = result

numl = [ ]

str_range = list ( range ( - 1 , 37 ) )

r_range = range ( - 1 , 36 )

r_list = [ 'black' , 'red' , 'low' , 'high' , 'even' , 'odd' , 'first dozen' , 'second dozen' , 'third dozen' , 'first column' , 'second column' , 'third column' , str_range , ]

pots = 1

def inputplayers ( ) :

playername = None

while playername != '' :

playername = str ( input ( 'Player Name? : ' ) )

if playername != '' :

players [ playername ] = 500

def checkup ( ) :

global pots

for key in players:

print ( 'Current Pot for' , key , ':' , players [ key ] )

pots = sum ( players. values ( ) )

def checkpots ( ) :

global pots

pots = sum ( players. values ( ) )

def check ( ) :

global result

global betlocation

global spinbet

if betlocation is black:

if result in r_black:

spinbet = spinbet * 2

def spin ( ) :

global result

result = random . randint ( - 1 , 36 )

def bet ( ) :

global r_list

global pots

global spinbet

global players

global s_bet

for key in players:

betlocation = None

maxbet = players [ key ]

while betlocation != '' :

if maxbet <= 0 :

betlocation = ''

continue

betlocation = str ( input ( '

Type help for list of bets.

' + 'What bet would you like, ' + key + '? : ' ) ) . lower ( )

if betlocation == 'help' :

print ( 'Possible bets are :' , r_list )

continue

if betlocation not in r_list and betlocation not in str ( str_range ) :

print ( 'Invalid bet!' )

continue

if betlocation != '' :

print ( '

max bet for ' , key , ' is : ' , maxbet )

spinbet = input ( 'How Much would you like to bet? : ' )

try :

spinbet = int ( spinbet )

except :

print ( 'Invalid Bet' )

continue

if spinbet > maxbet:

print ( 'That bet is too large!' )

continue

players [ key ] - = spinbet

maxbet - = spinbet

if betlocation == 'black' :

if result in r_black:

spinbet = spinbet * 2

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'red' :

if result in r_red:

spinbet = spinbet * 2

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'low' :

if result in r_low:

spinbet = spinbet * 2

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'high' :

if result in r_high:

spinbet = spinbet * 2

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'odd' :

if result in r_odd:

spinbet = spinbet * 2

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'even' :

if result in r_even:

spinbet = spinbet * 2

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'first dozen' :

if result in r_firstdozen:

spinbet = spinbet * 3

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'second dozen' :

if result in r_seconddozen:

spinbet = spinbet * 3

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'third dozen' :

if result in r_thirddozen:

spinbet = spinbet * 3

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'first column' :

if result in r_firstcolumn:

spinbet = spinbet * 3

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'second column' :

if result in r_secondcolumn:

spinbet = spinbet * 3

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation == 'third column' :

if result in r_thirdcolumn:

spinbet = spinbet * 3

else :

spinbet = 0

players [ key ] + = spinbet

if betlocation in str ( r_range ) :

if str ( result ) == betlocation:

spinbet = spinbet * 36

else :

spinbet = 0

players [ key ] + = spinbet

print ( 'Welcome to Roulette!

Press enter when done!' )

inputplayers ( )

while pots > 0 :

checkup ( )

spin ( )

bet ( )

print ( '

The ball lands on :' , result )

checkpots ( )