Nov-17-2016, 09:48 PM
import random #Simulate the process of dealing of 1000 cards print "Card dealing simulator" print "By:" Club = 0 Dia = 0 Heart = 0 Spade = 0 ClubC = 0 DiaC = 0 HeartC = 0 SpadeC = 0 Count = 0 while True: Cards = (random.random() * 52) + 1 Count = Count + 1 if 0 < Cards < 14: ClubC = ClubC + 1 elif 14 < Cards < 27: DiaC = DiaC + 1 elif 26 < Cards < 40: HeartC = HeartC + 1 elif 39 < Cards < 53: SpadeC = SpadeC + 1 elif Count == 1000: print "1000 cards have been dealt" break print "There were " + str(ClubC) + " clubs cards dealt" print "There were " + str(DiaC) + " diamonds cards dealt" print "There were " + str(HeartC) + " heart cards dealt" print "There were " + str(SpadeC) + " spade cards dealt" raw_input()I'm having trouble with this code and i wanted to see if anyone can see a problem with the code. It runs occasionally but most of the time it only inputs the print type and doesn't do anything else.
Part of my belief is that my computer may just not be able to handle the proccessing of 1000 runs through.