Added if __name__ == "__main__": check.
This commit is contained in:
parent
ea3f4e0a7c
commit
5d40aaa363
12
hangfish.py
12
hangfish.py
@ -48,10 +48,11 @@ 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)
|
||||||
@ -59,4 +60,7 @@ while (hangFish.running):
|
|||||||
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