HANGMAN Program in Python
Program:
# Program developed by ARUN # Copyrights owned by DATA DEMONS from time import sleep print("H", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("A", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("N", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("G", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("M", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("A", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("_", end = '') sleep(0.2) print("N") sleep(0.3) print("RULES :-") sleep(0.3) print("1) 6 Levels are there to win.") sleep(0.3) print("2) You will get only 6 chances to find answers for each Levels.") question = ["Gender", "Country", "Color", "Animal", "Subject", "Language",] ans = ["MALE", "INDIA", "RED", "LION", "PHYSICS", "FRENCH"] won = 0 for i in range(len(question)): word = list(ans[i]) print("LEVEL", i + 1) print("IT's a", question[i]) print("_" * len(ans[i])) Life = 6 print("Life :", Life) od = [] a1 = 0 while Life > 0 and a1 != len(word): inp = input("Enter a guess :") inp = inp.upper() if inp in word and inp not in od: od.append(inp) a1 += word.count(inp) for j in word: if j in od: print(j, end= '') else: print("_", end = '') print() else: print("Wrong guess") Life -= 1 print("Life :", Life) if Life == 0: print("G", end = '') sleep(0.2) print("A", end = '') sleep(0.2) print("M", end = '') sleep(0.2) print("E", end = '') sleep(0.2) print(" ", end = '') sleep(0.2) print("O", end = '') sleep(0.2) print("V", end = '') sleep(0.2) print("E", end = '') sleep(0.2) print("R") sleep(0.2) break else: won += 1 if won == 6: print("Y", end = '') sleep(0.2) print("O", end = '') sleep(0.2) print("U", end = '') sleep(0.2) print(" ", end = '') sleep(0.2) print("W", end = '') sleep(0.2) print("O", end = '') sleep(0.2) print("N", end = '') sleep(0.2)
Programmer details : Arun Meyyappan PL
Software used: Visual studio CODE
Version : 1.74
Documents and files download link
Python File(.py)
Text File(.txt)
0 Comments