-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgoplay.py
executable file
·40 lines (32 loc) · 1.25 KB
/
goplay.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
# Quick demo for using the pytextgames library
from pytextgames import Guessthenumber, Hangman, Blackjack, RockPaperScissors
playername = input("Hi, there!\nWhat's your name?\n")
games = ["Guess the number", "Hangman", "Blackjack", "Rock, Paper, Scissors"]
print("Hello, {0}, nice to meet you!".format(playername))
print("How are you today?")
print("Your name is {0} characters long.".format(len(playername)))
while True:
answer = input("Would you like to play another game? ")
if answer not in ["yes", "y", "yeah", "hell yeah", "you bet"]:
print("Maybe another time.\nBye!")
exit(0)
else:
print("I have games available.".format(len(games)))
print("Which game would you like to play? ")
for game in games:
print(str(games.index(game)+1), game)
choice = input("Enter the number of the game: ")
print(choice)
if choice == "1":
g = Guessthenumber(playername, 1, 100)
g.play()
elif choice == "2":
h = Hangman(playername)
h.play()
elif choice == "3":
b = Blackjack(playername)
b.play()
elif choice == "4":
r = RockPaperScissors(playername)
r.play()