Ejemplo n.º 1
0
def Hangman():
    global letters
    global word
    global guesses
    global goodLetters
    letters = 'abcdefghijklmnopqrstuvwxyz'
    winOrLose = False
    userWord = False
    lives = 11
    livesUsed = 0
    guesses = []
    goodLetters = []

    print('How many players?')
    while userWord == False:
        numPlayers = input()
        if numPlayers == '1' or numPlayers == '2':
            int(numPlayers)
            break
        else:
            print('Please enter \'1\' or \'2\'')

    if numPlayers == '1':
        word = __getWordFromList__()
    else:
        word = __getWord__()

    print(500 * '\n')
    while userWord == False:
        if livesUsed >= lives:
            break
        __showWord__(word, goodLetters)
        print('\nGuesses: ', end='')
        for i in range(len(guesses)):
            if i == 0:
                print(guesses[i], end='')
            else:
                print(', ' + guesses[i], end='')
        __lifeCounter__(livesUsed)
        guess = __makeGuess__()
        if guess == False:
            livesUsed += 1
        if __checkWord__() == True:
            userWord = True
            winOrLose = True

    __lifeCounter__(livesUsed)
    dictionary = PyDictionary(word)
    print(dictionary.printMeanings() + '\n')
    if winOrLose == True:
        print('You Win!')
    else:
        print('You Lose!')
    print(str(len(guesses)) + ' guesses')
    print('Used ' + str(livesUsed) + '/11 lives')
Ejemplo n.º 2
0
import warnings
warnings.filterwarnings("ignore",
                        category=UserWarning,
                        module='beautifulsoup4')

from PyDictionary import PyDictionary

dictionary = PyDictionary("hotel", "ambush", "nonchalant", "perceptive")

'There can be any number of words in the Instance'

print(dictionary.printMeanings())
print(dictionary.getMeanings())
print(dictionary.getSynonyms())
Ejemplo n.º 3
0
def find_meaning():
    word = e1.get()
    dictionary = PyDictionary(word)
    meaning = dictionary.printMeanings()
    print(meaning)
Ejemplo n.º 4
0
from PyDictionary import PyDictionary
dictionary=PyDictionary()

print(dictionary.printMeanings("flemme"))
print(dictionary.getMeanings())
print(dictionary.getSynonyms())
Ejemplo n.º 5
0
def nemo_maana():
    kalma = entry.get()
    dictionary = PyDictionary(kalma)
    maana = dictionary.printMeanings()
    print(maana)
Ejemplo n.º 6
0
def meanings(words):
    # words = input('Enter words separated by space if more than one')
    many = words.split()
    means = PyDictionary(many)
    print(means.printMeanings())
Ejemplo n.º 7
0
 def dictionary():
     message_dict = raw_input("Enter Word : ")
     dictionary = PyDictionary(message_dict)
     print(dictionary.printMeanings())
     print "Translation To Hindi : {0}".format(
         (dictionary.translate(message_dict, 'hi')))