User Profile

Collapse

Profile Sidebar

Collapse
Jimmy45
Jimmy45
Last Activity: May 3 '10, 03:59 PM
Joined: Apr 25 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Jimmy45
    started a topic How to get possible words from the given letters?

    How to get possible words from the given letters?

    I have some problem with one task (only this task left from 12 tasks). I am trying to write a scrabble code on python.

    I have to write a function that gets all the possible words from the given letters in hand. And there is an asterisk that can be replaced by any letter.
    For example:

    Given letters = 'crn*'
    Words can be = 'cry', 'corn' and etc. I can't get all the possible words when there is an asterisk....
    See more | Go to post

  • How to check if the element is contained in list or not?

    Hello,

    I have some problem with checking if the element is contained in the list or not.

    For example:
    a = ['abc', 'def', 'gh', 'i']
    b = 'abc'

    Following is my code:
    Code:
    def is_proper_word(b, a) :
    
        is_proper = False
        for b in proper_word_list:
            is_proper = True
        return is_proper
    Is it correct?

    ...
    See more | Go to post

  • Hello!

    I am doing my homework and trying to get possible words from given letters.
    For example:
    Here is your hand: AONEP

    Enter your word: ?
    (POPPA, 11)
    (NAPPE, 9)
    (NAPPA, 9)
    (POPE, 8)
    (POOP, 8)
    (PEPO, 8)
    (PEEP, 8)
    (PAPA, 8)

    It must use p only once, but here is more that one. Can you please help me to find my mistake. Following is my...
    See more | Go to post

    Leave a comment:


  • Is there any other way to do it? Because we can't use any set command in our homework.


    Thank you....
    See more | Go to post

    Leave a comment:


  • Thank you for your kind attention to my question. Yes, I am doing my python homework. I have a question about how to check if every element in one list is contained in the another list. For example:
    a = ['a', 'b', 'c'] and b = ['c', 'a']...
    See more | Go to post

    Leave a comment:


  • Jimmy45
    started a topic How to get possible words from the given letters?

    How to get possible words from the given letters?

    Hello,

    I am writing a "scrabble code" on Python. I have some problem with getting possible words from the given letters. For example:
    Given letters are: 'c', 'r', 'n', '*'
    Here '*' can be any letter.
    Possible words: 'cry', 'corn', 'run', etc.
    proper_word_lis t is a file containing all the english words.
    score_of_word is a function that computes the score of the word.
    hand is the...
    See more | Go to post

  • Thank you very much :))) It's working!!!!!!!...
    See more | Go to post

    Leave a comment:


  • Jimmy45
    started a topic How to convert a string into list of strings

    How to convert a string into list of strings

    Hello,
    I am trying to convert a string into list of strings.
    The output is like the following:
    [['a', 'a'], ['b'], ['c']].

    However, the output must be like:
    ['a', 'a', 'b', 'c']

    My code is like the following:

    Code:
    return_letter = ""
    letter_list = []
    f = open(file_name,"r")
    for line in f:
            k = line[:1]
            letter_list.append(k.split()*int(line[1:]))
    ...
    See more | Go to post
    Last edited by bvdet; Apr 25 '10, 11:57 PM. Reason: Add code tags
No activity results to display
Show More
Working...