Python Script for "Change A Letter Game [2] "...


  1. Posts : 22,740
    Windows 10 Home x64
       #1

    Python Script for "Change A Letter Game [2] "...


    Well, I just finished a script in Python to help select a new word for the Change a Letter Game. The inputs are 1) letter to skip and then the three letters to look for. So far it looks/works great and I plan on working on the code to add a function. Is the cheating.. yes but the goal was to write a useful and fun script in Python ver 2.7.9.

    PHP Code:
    #-------------------------------------------------------------------------------
    #
    #-------------------------------------------------------------------------------
    found_letters int(0)
    new_words = list()

    #Get letter to skip and the 3 letters to serch for,,
    skip_letter raw_input("Enter letter to skip:")
    letter_one raw_input("Enter first letter to search for:")
    letter_two raw_input("Enter second letter to search for:")
    letter_three raw_input("Enter third letter to search for:")

    fh open("words.txt",'r')
    for 
    line in fh:
        
    word line.rstrip().lower()
        for 
    x in range(1,4):
            if (
    skip_letter == word[x]):
                
    found_letters += 1

        
    if (found_letters == 0):
            for 
    x in range(1,4):
                if (
    letter_one == word[x]):
                    
    found_letters += 1

            
    if (found_letters == 1):
                for 
    x in range(1,4):
                    if (
    letter_two == word[x]):
                        
    found_letters += 1

            
    if (found_letters == 2):
                for 
    x in range(1,4):
                    if (
    letter_three == word[x]):
                        
    found_letters += 1

            
    if (found_letters == 3):
                
    new_words.append(word)

        
    found_letters 0

    #Print out results...
    entries len(new_words)
    for 
    x in range(0,entries):
        print 
    "New word:",1," "new_words[x
    Last edited by BunnyJ; 21 Feb 2015 at 18:13. Reason: Add content..
      My Computer


  2. Posts : 16,623
    Windows 11 Pro X64
       #2

    I see goldmember in your future
      My Computers


  3. Posts : 22,740
    Windows 10 Home x64
    Thread Starter
       #3

    Dude said:
    I see goldmember in your future
    I do,, and this code needs work. Serious work I think. Darn.. must test code MORE!!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:14.
Find Us




Windows 10 Forums