Cs Project
Cs Project
Student Information
Student Signature
2
CERTIFICATE
_____________________________
Signature of Internal Examiner
____________________
Principal’s Signature
3
CONTENT / INDEX
4
INTRODUCTION
5
MINIMUM SYSTEM REQUIREMENTS:
CPU I5 Processor
RAM 4 GB
Software
Frontend Python
PYTHON CODE
6
import pygame
from pygame import mixer
mixer.init()
mixer.music.load('C:/Users/Rupu/Downloads/the-epic-2-by-rafael-krux(chosic.com).mp3')
mixer.music.play()
import random
def isword(guess,wordly_word):
for x in guess:
print(x,end="")
def read_words_from_file(file_name):
with open(file_name, "r") as file:
words = file.read().splitlines()
return words
words=read_words_from_file("C:\\Users\\Rupu\\Downloads\\words.txt")
word = random.choice(words)
print(" \n Welcome to word guessing game")
print(f"The word has {len(word)} letters")
message,max_attempts = {0:"Marvellous",1:"Excellent",2:"Very
good",3:"Nice",4:"Good",5:"Ok"},6
print(f"you have {max_attempts} attempts to guess the word")
words1=word.split()
for i in words1:
n=i[0]
if n in ('a', 'e', 'i', 'o', 'u'):
print("The first letter of word is vowel")
else:
print('The first letter of the word is consonsont')
while max_attempts>=0:
guess=input("\nEnter your guess: ")
if len(guess)==7 and guess.isalpha():
print("You guessed wrong")
print("The word has",len(word),"letters!!!")
continue
if guess in word:
print("Congratulations! You guessed the word correctly")
print(random.choice(message))
print("Thank you for participating in this game")
break
elif max_attempts<=6 and max_attempts>4:
print("you guessed wrong!!")
7
max_attempts-=1
print("Attempts left:", max_attempts)
print("Here is your clue")
for i in words1:
print("The first letter of the word is",i[0])
continue
elif max_attempts==4:
max_attempts-=1
print("Attempts left:", max_attempts)
print("you guessed wrong!!")
print("Here is your another clue")
for i in words1:
q=i[1]
if q in ('a', 'e', 'i', 'o', 'u'):
print("The second letter of word is vowel")
else:
print('The second letter of the word is consonsont')
continue
elif max_attempts==3:
max_attempts-=1
print("Attempts left:", max_attempts)
print("you guessed wrong!!")
print("Here is your another clue")
for i in words1:
print("The second letter of the word is",i[1])
continue
8
Output-
pygame 2.5.2 (SDL 2.28.3, Python 3.11.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
9
FEATURES OF THE PROJECT
10
FUTURE SCOPE OF THE PROJECT
www.google.com
12