Project (CS)
Project (CS)
REQUIRED
HARDWARES:--
1. Desktop / Laptop
2. Mobile Phone
SOFTWARES
1. Python (Latest version)
ACKNOWLDEGMENT
It is with pleasure that I acknowledge my
sincere gratitude to our teacher, MR. SUNIL
KUMAR, PGT(CS) who taught and undertook
the responsibility of teaching the subject
computer science. I have been greatly
benefited from his classes.
I am especially indebted to our Principal MR.
RAJEEV RANJAN PRASAD SINHA who has
always been a source of encouragement and
support and without whose inspiration this
project would not have been a successful. I
would like to place on record a heartfelt
thanks to him.
CERTIFICATE
This is to certify that BHAVESH of class XI-A of
SARVODAYA VIDYALAYA SECTOR—7 has done his
project of MULTIPLE GAME SYSTEM under my
supervision. He has taken interest and has shown at
most sincerity in completion of this project.
I certify this project up to my expectation & as per
guidelines issued by CBSE, NEW DELHI.
def hangman():
words = ['python', 'hangman', 'challenge', 'programming',
'developer']
word = random.choice(words)
guessed = '_' * len(word)
guessed_list = list(guessed)
attempts = 6
guessed_letters = set()
print("Welcome to Hangman!")
if guess in guessed_letters:
print("You've already guessed that letter.")
continue
elif len(guess) != 1 or not guess.isalpha():
print("Please enter a single letter.")
continue
guessed_letters.add(guess)
if guess in word:
for index, letter in enumerate(word):
if letter == guess:
guessed_list[index] = guess
print("Good guess!")
else:
attempts -= 1
print("Wrong guess!")
def number_guessing_game():
number_to_guess = random.randint(1, 100)
attempts = 10
print("Welcome to the Number Guessing Game!")
attempts -= 1
def word_guessing_game():
words = ['apple', 'banana', 'cherry', 'date', 'elderberry']
word = random.choice(words)
guessed_word = ''
attempts = 5
print("Welcome to the Word Guessing Game!")
if guess == word:
print(f'Congratulations! You guessed the word: {word}')
return
else:
attempts -= 1
print(f'Wrong guess! Attempts left: {attempts}')
def main():
while True:
print("\nChoose a game to play:")
print("1. Hangman")
print("2. Number Guessing Game")
print("3. Word Guessing Game")
print("4. Exit")
if choice == '1':
hangman()
elif choice == '2':
number_guessing_game()
elif choice == '3':
word_guessing_game()
elif choice == '4':
print("Thanks for playing!")
break
else:
print("Invalid choice. Please choose again.")
if __name__ == "__main__":
main()
OUTPUTS
Starting of the program:-