Python Hangman (With Lists, If/Else, While Loops)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

can you make a more advanced one with a menu, difficulties and leaderboard that uses functions?

HumuNuku
Автор

a few issues with the code is the list doesnt move it just stays a the first one, it appends to currentlist but wont display the letters on the wordpicked, also some syntax errors with the if/else statement guess in wordpicked

squidwardsgamingchannel
Автор

hey man i have some issues with the while wrong guesses < Max_Wrong it keeps showing up as a syntax error and am not sure how to fix it as my code is pretty much identical to yours help would be appreciated if can be provided thanks

elyankhan
Автор

me pasa que el dibujo se mantiene igual que puedo hacer?

pablohaas
Автор

It happens to me that the drawing remains the same, what can I do?

import random
import time

print('Bienvenido al colgado')

jugador_1=input('Ingresa tu nombre jugador 1:')
jugador_2=input('Ingresa tu nombre jugador 2:')

print('Primero', jugador_1, 'adivinaras una palabra letra por letra y luego', jugador_2, 'tendras que adivinar una tu. El que acierte la palabra en menos fallos gana. Se les dara puntos dependiendo los fallos que hagan.')
time.sleep(0.5)
print('\nTendran 7 vidas por lo que si tienen 7 letras mal pierden')


DIBUJO = ['''
+---+
| |
|
|
|
|
'''
+---+
| |
O |
|
|
|
'''
+---+
| |
O |
| |
|
|
'''
+---+
| |
O |
/| |
|
|
'''
+---+
| |
O |
/|\ |
|
|
'''
+---+
| |
O |
/|\ |
/ |
|
'''
+---+
| |
O |
/|\ |
/ \ |
|



palabras=['SANGRE', 'NEGOCIO', 'PUBLICIDAD', 'BUENA', 'ROEDOR', 'LEON', 'JIRAFA', 'FUTBOL', 'COLEGIO', 'AUTO', 'CAMION', 'MADERA', 'ARBOL', 'AMIGOS', 'CERRO', 'COMPUTADOR', 'FLORES', 'PELOTA', 'JUICIO', 'GUARDIA', 'WHATSAPP', 'INSTAGRAM', 'DISCORD', 'AMAZON', 'PROFESOR', 'CABEZA', 'CUERPO', 'MANOS', 'FOTOS', 'VIDEOS', 'CARGADOR', 'YOUTUBE', 'CARPETA', 'CELULAR', 'RELOJ', 'PERRO', 'GATO', 'SOL', 'LUNA', 'ESPACIO', 'AUDIFONOS', 'ELEFANTE', 'HIPOPOTAMO', 'PISCINA', 'PASTO', 'TIERRA', 'AGUA', 'ELECTRICIDAD', 'ENOJADO', 'FELIZ', 'TRISTE', 'VENTILADOR', 'DEPREDADOR', 'OTORRINOLARINGOLOGO']

max_malas=len(DIBUJO)-1






fallos_1=0
vidas_1=7
letras_ocupadas_1=[]

while fallos_1 < max_malas and actual_adivinanza_1 != palabra_jugador_1:
print(DIBUJO[fallos_1])
print(jugador_1, 'Haz usado las siguientes letras:', letras_ocupadas_1)
print(jugador_1, ' Hasta ahora tu palabra es:', actual_adivinanza_1)

adivinar_1=input('Adivina una letra:')


while adivinar_1 in letras_ocupadas_1:
print('Ya haz usado esta letra', adivinar_1)
adivinar_1=input('Prueba con otra letra:')




if adivinar_1 in palabra_jugador_1:
print('Haz adivinado bien')

nueva_actual_adivinanza_1=''
for letra_1 in
if

else:



else:
print(jugador_1, 'Estas incorrecto:(')
fallos_1+=1

if fallos_1==max_malas:
print(DIBUJO[fallos_1])
print('HAZ PERDIDO', jugador_1)
print('La palabra correcta era', palabra_jugador_1)

else:
(jugador_1, 'Haz ganado')

pablohaas