def pass_gen(size=10, chars=string.ascii_letters + string.digits + string.punctuation): return ''.join(random.choice(chars) for _ in range(size))
# r p s 2 player game from Exam import random words = ["r","p" ,"s"] #list of words chances = 1 p1 = p2 =0 #to store the score print "rock = r \n scissor = s \n paper = p \n" while chances <= 5: # for 10 chances print chances player1 = raw_input("Player 1 : ") #getting input from user #print player1 player2 = random.choice(words) # random play by computer print "Player 2 : " ,player2 #print player2 if(player1 == player2): #scoring rules of the game p1+=1 p2+=1 elif(player1 == 'r' and player2 == 's'): p1+=1 elif(player1 == 's' and player2 == 'r'): p2+=1 elif(player1 == 's' and player2 == 'p'): p1+=1 elif(player1 == 'p' and player2 == 's'): p2+=1 elif(player1 == 'p' and player2 == 'r'): p1+=1 elif(player1 == 'r' and player2 == 'p'):
from Exam import random words = [ 'kerala', 'karnataka', 'pune', 'delhi', 'punjab', ] word = random.choice(words) word.lower() length = len(word) g = [] guessed_word = [] for n in word: guessed_word.append('_') print('The word is') for i in range(0, length): print('_') for j in range(0, 10): l = raw_input('Enter the letter') l.lower() if l in g: print('Already Entered') else: g.append(l) if l in word: print('Guessed letter is correct') for x in range(0, length): if word[x] == l: guessed_word[x] = l