# nltk is a package that dowloads a lot of English words. It allows you to break many words into tokens or individual words.
# importing nltk allows you to use the python libraries abilities to use for your own purposes.
import nltk
# SUed to download a specific dataset of words from the natural language toolkit.
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Makign a list is like making a word bank where you can pull on word.
english_words = words.words()
# Select a random word from the list; The fucntion Random.choice lets you do this
random_word = random.choice(english_words)
Character= input("input a character that is lowercase")
Word_list= list(random_word)
ListNumb=0
LenList = len(Word_list)
Printing_Character= '#'
Guessing_List= LenList * Printing_Character
Guessing_List = list(Guessing_List)
LenList_two = LenList
x=Word_list[-1]
y='#'
while LenList == LenList:
while LenList_two <= 26:
if Character== Word_list[ListNumb]:
v = Word_list[ListNumb]
ListNumb = ListNumb+1
Guessing_List[ListNumb]= v
LenList_two = LenList_two-1
Character= input("input a character that is lowercase")
else:
ListNumb = ListNumb+1
LenList_two = LenList_two-1
if x==y:
break
else:
pass
print(Guessing_List)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase a
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/tmp/ipykernel_16443/2077171780.py in <module>
27 while LenList == LenList:
28 while LenList_two <= 26:
---> 29 if Character== Word_list[ListNumb]:
30 v = Word_list[ListNumb]
31 ListNumb = ListNumb+1
IndexError: list index out of range
# nltk is a package that dowloads a lot of English words. It allows you to break many words into tokens or individual words.
# importing nltk allows you to use the python libraries abilities to use for your own purposes.
import nltk
# SUed to download a specific dataset of words from the natural language toolkit.
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Makign a list is like making a word bank where you can pull on word.
english_words = words.words()
# Select a random word from the list; The fucntion Random.choice lets you do this
random_word = random.choice(english_words)
Character= input("input a character that is lowercase")
Word_list= list(random_word)
ListNumb=0
LenList = len(Word_list)
Printing_Character= '#'
Guessing_List= LenList * Printing_Character
Guessing_List = list(Guessing_List)
for ListNumb in range(LenList):
if Character== Word_list[ListNumb]:
ListNumb = ListNumb+1
Guessing_List[ListNumb]= Character
Character= input("input a character that is lowercase")
else:
ListNumb = ListNumb+1
print(Guessing_List)
print(random_word)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase i
input a character that is lowercase e
input a character that is lowercase p
['#', '#', '#', '#', 'i', '#', '#', '#', 'e', '#', '#']
calisthenic
import nltk
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Making a list is like making a word bank where you can pull one word.
english_words = words.words()
# Select a random word from the list; The function random.choice lets you do this
random_word = random.choice(english_words)
Character = input("input a character that is lowercase")
Word_list = list(random_word)
ListNumb = 0
LenList = len(Word_list)
Printing_Character = '#'
Guessing_List = LenList * Printing_Character
Guessing_List = list(Guessing_List)
for ListNumb in range(LenList):
if Character == Word_list[ListNumb]:
ListNumb = ListNumb + 1
Guessing_List[ListNumb] = Character
Character = input("input a character that is lowercase")
print(Guessing_List)
else:
ListNumb = ListNumb + 1
Character = input("input a character that is lowercase")
print(Guessing_List)
print(Guessing_List)
print(random_word)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase a
input a character that is lowercase e
['#', '#', '#', '#', '#', '#', '#', '#']
input a character that is lowercase i
['#', '#', '#', '#', '#', '#', '#', '#']
input a character that is lowercase u
['#', '#', '#', '#', '#', '#', '#', '#']
input a character that is lowercase n
['#', '#', '#', '#', '#', '#', '#', '#']
input a character that is lowercase l
['#', '#', '#', '#', '#', 'n', '#', '#']
input a character that is lowercase d
['#', '#', '#', '#', '#', 'n', '#', '#']
input a character that is lowercase r
['#', '#', '#', '#', '#', 'n', '#', '#']
input a character that is lowercase u
['#', '#', '#', '#', '#', 'n', '#', '#']
['#', '#', '#', '#', '#', 'n', '#', '#']
Satanity
import nltk
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Making a list is like making a word bank where you can pull one word.
english_words = words.words()
# Select a random word from the list; The function random.choice lets you do this
random_word = random.choice(english_words)
Character = input("input a character that is lowercase")
Word_list = list(random_word)
ListNumb = 0
Guessing_Tries = -3
LenList = len(Word_list)
a
Printing_Character = '#'
Guessing_List = LenList * Printing_Character
Guessing_List = list(Guessing_List)
Duplicate_Numb=0
for ListNumb in range(LenList):
if Character == Word_list[ListNumb]:
Guessing_List[ListNumb] = Character
ListNumb = ListNumb + 1
print(Guessing_List)
else:
print(Guessing_List)
ListNumb = ListNumb + 1
Character = input("input a character that is lowercase")
print(Guessing_List)
print(random_word)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase a
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', '#', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', 'a', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', 'a', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', 'a', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', 'a', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', 'a', '#', '#', '#', '#', '#']
['#', '#', '#', '#', '#', 'a', '#', '#', '#', 'a', '#', '#', '#', '#', '#']
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
/tmp/ipykernel_16443/2990974071.py in <module>
37 print(Guessing_List)
38 ListNumb = ListNumb + 1
---> 39 Character = input("input a character that is lowercase")
40
41 print(Guessing_List)
~/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py in raw_input(self, prompt)
1200 msg = "raw_input was called, but this frontend does not support input requests."
1201 raise StdinNotImplementedError(msg)
-> 1202 return self._input_request(
1203 str(prompt),
1204 self._parent_ident["shell"],
~/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py in _input_request(self, prompt, ident, parent, password)
1243 # re-raise KeyboardInterrupt, to truncate traceback
1244 msg = "Interrupted by user"
-> 1245 raise KeyboardInterrupt(msg) from None
1246 except Exception:
1247 self.log.warning("Invalid Message:", exc_info=True)
KeyboardInterrupt: Interrupted by user
input a character that is lowercase a
import nltk
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Making a list is like making a word bank where you can pull one word.
english_words = words.words()
# Select a random word from the list; The function random.choice lets you do this
random_word = random.choice(english_words)
Character = input("input a character that is lowercase")
Word_list = list(random_word)
ListNumb = 0
Guessing_Tries = -3
LenList = len(Word_list)
Printing_Character = '#'
Guessing_List = LenList * Printing_Character
Guessing_List = list(Guessing_List)
while x in range(10):
for Guessing_Tries in range(LenList):
if Character == Word_list[ListNumb]:
Guessing_List[ListNumb] = Character
ListNumb = ListNumb + 1
elif ListNumb<LenList:
ListNumb = ListNumb + 1
else:
Guessing_Tries= Guessing_Tries + 1
Character = input("input a character that is lowercase")
print(Guessing_List)
ListNumb = 0
print(Guessing_List)
print(random_word)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase a
['#', '#', '#', '#', '#', '#']
lanket
# Initialize Guessing_Tries
Guessing_Tries = 0
while '_' in Guessing_List and Guessing_Tries < 6: # Limit to 6 incorrect guesses
Character = input("Input a lowercase character: ").lower()
if len(Character) != 1 or not Character.islower():
print("Invalid input. Please enter a lowercase character.")
continue
character_found = False
for ListNumb in range(LenList):
if Character == Word_list[ListNumb]:
Guessing_List[ListNumb] = Character
character_found = True
if not character_found:
print(f"{Character} is not in the word.")
Guessing_Tries += 1
# Display the current state of the word
print(" ".join(Guessing_List))
# End of the game
if '_' not in Guessing_List:
print("Congratulations! You guessed the word:", random_word)
else:
print("Sorry, you ran out of guesses. The word was:", random_word)
Congratulations! You guessed the word: woesome
import nltk
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Making a list is like making a word bank where you can pull one word.
english_words = words.words()
# Select a random word from the list; The function random.choice lets you do this
random_word = random.choice(english_words)
Character = input("input a character that is lowercase")
Word_list = list(random_word)
ListNumb = 0
Guessing_Tries = -3
LenList = len(Word_list)
Printing_Character = '#'
Guessing_List = LenList * Printing_Character
Guessing_List = list(Guessing_List)
Duplicate_Numb=0
for Guessing_Tries in range(LenList):
if Character == Word_list[ListNumb]:
Guessing_List[ListNumb] = Character
ListNumb = ListNumb + 1
Character = input("input a character that is lowercase")
print(Guessing_List)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase a
input a character that is lowercase e
['#', '#', '#', '#', '#', '#']
Printing_Character = '#'
Guessing_List = LenList * Printing_Character
Guessing_List = list(Guessing_List)
print(Guessing_List)
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
import nltk
nltk.download('words')
from nltk.corpus import words
import random
# Get the list of English words; Making a list is like making a word bank where you can pull one word.
english_words = words.words()
# Select a random word from the list; The function random.choice lets you do this
random_word = random.choice(english_words)
Word_list = list(random_word)
ListNumb = 0
Guessing_Tries = -3
LenList = len(Word_list)
Printing_Character = '#'
Guessing_List = LenList * Printing_Character
Guessing_List = list(Guessing_List)
Character = input("input a character that is lowercase")
for ListNumb in range(LenList):
if Character == Word_list[ListNumb]:
Guessing_List[ListNumb] = Character
ListNumb = ListNumb + 1
break
elif ListNumb<LenList:
ListNumb = ListNumb + 1
elif ListNumb>LenList:
Guessing_Tries= Guessing_Tries + 1
Character = input("input a character that is lowercase")
print(Guessing_List)
ListNumb = 0
print(Guessing_List)
print(random_word)
[nltk_data] Downloading package words to /home/eneter/nltk_data...
[nltk_data] Package words is already up-to-date!
input a character that is lowercase a
['#', '#', '#', '#', '#', '#', '#', '#', '#', '#']
Chamaerops