Advertisement
j311yf1sh

Python Random Test

Jun 1st, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.44 KB | None | 0 0
  1. from math import *
  2. from random import *
  3. from sys import exit
  4.  
  5. NameList = list()
  6. ListOfName = list()
  7. NameLength = 0
  8. Name = len(ListOfName)
  9. Lenty = 0
  10. Testy = 0
  11. while NameLength == 0:
  12.     print 'Please input letter one at a time then input a space to continue'
  13.     Namey = raw_input('Letter: ')
  14.    
  15.     ListOfName.append(Namey)
  16.     if ' ' in Namey:
  17.         ListOfName.remove(' ')
  18.         NameLength+= 1
  19.        
  20.     print ListOfName
  21.  
  22. Lenty = raw_input('How Many Letters is that? ')
  23.        
  24. while NameList != ListOfName:
  25.  
  26.     if Testy != Lenty:
  27.         Testy = len(NameList)
  28.        
  29.         print NameList
  30.        
  31.         Letter = randint(1,3)
  32.  
  33.         if Letter == 1:
  34.             NameList.append('a')
  35.  
  36.         if Letter == 2:
  37.             NameList.append('b')
  38.            
  39.         #if Letter == 3:
  40.          #   NameList.append('c')
  41.  
  42.         if Letter == 4:
  43.             NameList.append('d')
  44.  
  45.         '''if Letter == 5:
  46.            NameList.append('e')
  47.  
  48.        if Letter == 6:
  49.            NameList.append('f')
  50.  
  51.        if Letter == 7:
  52.            NameList.append('g')
  53.  
  54.        if Letter == 8:
  55.            NameList.append('h')
  56.  
  57.        if Letter == 9:
  58.            NameList.append('i')
  59.  
  60.        if Letter == 10:
  61.            NameList.append('j')
  62.    '''
  63.  
  64.         print Testy
  65.     elif Testy >= Lenty:
  66.        while Testy > 0:
  67.            print 'Popping!'
  68.            NameList.pop(0)
  69.        
  70.  
  71. print 'Bingo!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement