Added if __name__ == "__main__": check.
This commit is contained in:
parent
ea3f4e0a7c
commit
5d40aaa363
24
hangfish.py
24
hangfish.py
@ -48,15 +48,19 @@ class HangFish():
|
|||||||
def getString(self):
|
def getString(self):
|
||||||
return self.graphical_string + 'guesses left = {}\n'.format(self.guesses) + self.graphical_progress_string
|
return self.graphical_string + 'guesses left = {}\n'.format(self.guesses) + self.graphical_progress_string
|
||||||
|
|
||||||
hangFish = HangFish(None, "Gen")
|
def main():
|
||||||
|
hangFish = HangFish(None, "Gen")
|
||||||
|
|
||||||
print(hangFish.getString())
|
print(hangFish.getString())
|
||||||
while (hangFish.running):
|
while (hangFish.running):
|
||||||
try:
|
try:
|
||||||
letter = str(input("Enter Letter\n"))[0]
|
letter = str(input("Enter Letter\n"))[0]
|
||||||
hangFish.guess(letter)
|
hangFish.guess(letter)
|
||||||
print(hangFish.getString())
|
print(hangFish.getString())
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("Please enter a letter.")
|
print("Please enter a letter.")
|
||||||
|
|
||||||
print (hangFish.status_message)
|
print (hangFish.status_message)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user