Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import choice
- STATE = [''' _____
- | |
- |
- |
- |
- __|_''',
- ''' _____
- | |
- O |
- |
- |
- __|_''',
- ''' _____
- | |
- O |
- | |
- |
- __|_''',
- ''' _____
- | |
- O |
- | |
- / |
- __|_''',
- ''' _____
- | |
- O |
- | |
- / \ |
- __|_''',
- ''' _____
- | |
- O |
- /| |
- / \ |
- __|_''',
- ''' _____
- | |
- O |
- /|\ |
- / \ |
- __|_''']
- LANGUAGES = {'hola mundo': 'español', 'hello world': 'inglés',
- 'hallo welt': 'alemán', 'bonjour monde': 'francés',
- 'ciao mondo': 'italiano', 'labas pasauli': 'lituano'}
- def guessing():
- print('¿Qué letra está en la frase?')
- guess = input().lower()
- return guess
- def is_in_word(picture, answer, blank, dictionary):
- state = 0
- while state < 6:
- print(picture[state])
- print('\n %s\n\n' %blank)
- if blank == answer:
- win(answer, dictionary)
- break
- guess = guessing()
- if guess.lower() == answer:
- blank = answer
- elif guess.lower() in answer:
- print(guess + ' está en la frase.')
- for i, letter in enumerate(answer):
- if guess.lower() == letter:
- blank = blank[:i] + letter + blank[i + 1:]
- elif guess.lower() not in answer:
- print(guess + ' no está en la frase.')
- state += 1
- if state == 6:
- lose(answer, dictionary, picture)
- def win(answer, dictionary):
- print('\n¡Bien! La respuesta era \'%s\', que significa \'hola mundo\' \
- en %s.\n' % (answer, dictionary[answer]))
- print('¡Hola, PyAr! Soy Filly, y este fue mi "Hola, mundo!". :)\n')
- def lose(answer, dictionary, picture):
- print(picture[6])
- print('\n %s\n' %blank)
- print('\nGame over. La respuesta era \'%s\', que \
- significa \'hola mundo\' en %s.\n' % (answer, dictionary[answer]))
- play = True
- while play:
- print('\n\nF I L L Y\' S A W E S O M E H A N G M A N G A M E \
- (???)\n')
- word = choice(list(LANGUAGES.keys()))
- space = word.find(' ')
- blank = '_' * len(word[:space]) + ' ' + '_' * len(word[space + 1:])
- is_in_word(STATE, word, blank, LANGUAGES)
- ask = input('¿Jugar de nuevo? Y/N: ')
- if ask.lower() in ('yes', 'y'):
- play = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement