🎓 Academic Pa help po. Çℎḙḡḡ unlock

Status
Not open for further replies.

jindori13

Fanatic
https://www.Çℎḙḡḡ.com/homework-help...repeatedly-assume-ten-10-words-stor-q37429398

sa may Çℎḙḡḡ account po paunlock po sana, aaralin lang po yung program.
 

Answer:




Program:

#importing to get random values
import random
#creating the word list
WORDS_LIST = ('meringue', 'albumen', 'foulard', 'eudaemonic', 'narcolepsy', 'elucubrate', 'vivisepulture', 'pococurante')
#selecting a random word
corr_word = random.choice(WORDS_LIST)
#variables
letter_guessed = ''
attempt = 5
#showing info to the user to proceed with the game
print('Word Guessing Game')
print('No of letters in words are: ',len(corr_word))
print('You have 5 attempts at guessing letters in a word')

#loop to try
for count in range(attempt):
#infinite loop
while True:
#guessing the letter in the word
guess = input('Guess a letter: ')
#check if the user has entered a letter
if len(guess) == 1:
break
else:
print("Oops! Guess a letter!")
#if the guessed letter is in the word
if guess in corr_word:
print('yes!')
letter_guessed += guess
else:
print('no!')
#ask user if he want to guess the whole word or still want to guess letter
ch=input('Want to guess the word: ')
if ch == 'y':
#show the user the guessed letters
print 'The guessed letters are: ', letter_guessed
guess_word = input('Guess the whole word: ')
#check if the entered word is right then show the message accordingly
if guess_word.lower() == corr_word:
print('Congrats!')
else:
print('Unlucky! The answer was ', corr_word)
break
else:
continue
#check if the user has exhausted his attempts
if count==5:
print('Attempts over. Exiting')
break
#Exiting the program
print('Thanks for playing')



----------------------------------------------------

Output:
1626353580757.webp
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 2
    Replies
  • 326
    Views
  • 2
    Participants
Last reply from:
jindori13

Online now

Members online
1,066
Guests online
919
Total visitors
1,985

Forum statistics

Threads
2,274,676
Posts
28,957,530
Members
1,233,398
Latest member
hades00
Back
Top