# import modules import itertools, random, os, time #Numbers card1=random.randint(1,13) card2=random.randint(1,13) #Suits card1Suit=random.randint(1,4) card2Suit=random.randint(1,4) # Print info os.system('clear') print("1st number is your card number, 2nd number is your suit") print("1 is Hearts, 2 is Diamonds, 3 is Spades, 4 Clubs") print("11 is Jack, 12 is Queen and 13 is King") print('\n') #Print 1st card print("Your first card is...") print(card1,card1Suit) print("The probaility for a 'prime square' is {0}%").format(float(3)/float(51)*100) print('\n') #Print 2nd card time.sleep(5) print("Your second card is...") print(card2,card2Suit) #If prime square is achieved if(card1==card2): print('\n') print("Your numbers are the same! You got a prime square!") print("You were part of that 5.88%") #Did not achieve a prime square else: print('\n') print("You did not achieve a prime square") time.sleep(10) #Get new numbers #Numbers card1=random.randint(1,13) card2=random.randint(1,13) card3=random.randint(1,13) card4=random.randint(1,13) card5=random.randint(1,13) card6=random.randint(1,13) #Suits card1Suit=random.randint(1,4) card2Suit=random.randint(1,4) card3Suit=random.randint(1,4) card4Suit=random.randint(1,4) card5Suit=random.randint(1,4) card6Suit=random.randint(1,4) #Add more people os.system('clear') print("What if we added more people?") print("How about 2 other people?") print("The probability is going to change since there will be less cards in the deck by your turn") time.sleep(5) #First Players 1st Draw print('\n') print("Player 1's turn...") print("Player 1's first card is...") time.sleep(2) print(card1,card1Suit) print("The probaility for a 'prime square' is {0}%").format(float(3)/float(51)*100) #First Players 2nd Draw print('\n') print("Player 1's second card is...") time.sleep(2) print(card2,card2Suit) #If prime square is achieved if(card1==card2): print('\n') print("Player 1's numbers are the same! They got a prime square!") #Did not achieve a prime square else: print('\n') print("They did not achieve a prime square") time.sleep(5) #Second Players 1st Draw print('\n') print("Player 2's turn...") print("Player 2's first card is...") time.sleep(2) print(card3,card3Suit) print("The probaility for a 'prime square' is {0}%").format(float(3)/float(47)*100) #Second Players 2nd Draw print('\n') print("Player 2's second card is...") time.sleep(2) print(card4,card4Suit) #If prime square is achieved if(card3==card4): print('\n') print("Player 2's numbers are the same! They got a prime square!") #Did not achieve a prime square else: print('\n') print("They did not achieve a prime square") time.sleep(5) #Third Players 1st Draw print('\n') print("Your turn...") print("Your first card is...") time.sleep(2) print(card5,card5Suit) print("The probaility for a 'prime square' is {0}%").format(float(3)/float(43)*100) #Third Players 2nd Draw print('\n') print("Your second card is...") time.sleep(2) print(card6,card6Suit) #If prime square is achieved if(card5==card6): print('\n') print("Your numbers are the same! You got a prime square!") #Did not achieve a prime square else: print('\n') print("You did not achieve a prime square")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question