Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
chatbot-final/guess a letter.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
38 lines (32 sloc)
1.03 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
row=["AFKPUZ","BGLQV","CHMRW","DINSX","EJOTY"] | |
horizontal=["ABCDE","FGHIJ","KLMNO","PQRST","UVWXY","Z"] | |
word=True | |
length=1 | |
entire_word="" | |
while word: | |
print("1 2 3 4 5 6") | |
for i in row: | |
string = "" | |
for j in i: | |
string+=j+" " | |
print(string) | |
first_input=int(input("Enter the the column number your letter is in : ")) | |
print("1 2 3 4 5 6") | |
for i in horizontal: | |
string = "" | |
for j in i: | |
string+=j+" " | |
print(string) | |
second_input=int(input("Enter the the column number your letter is in : ")) | |
for i in horizontal[first_input-1]: | |
for j in row[second_input-1]: | |
if i==j: | |
entire_word+=i | |
print(length,"letter/s found") | |
next_word=input("Do you want to continue for next letter in your word?(y/n)") | |
length+=1 | |
if next_word!="y": | |
word=False | |
print(entire_word) | |
print("You guessed this letter, didn't you?") | |
input() | |