python text adventure code example
Example 1: text based game python
x1=0
x2=0
x3=0
x4=0
x5=8
x6=0
x7=0
x8=0
x9=0
for x in "banana":
print(x1, x2, x3)
print(x4, x5, x6)
print(x7, x8, x9)
ducky=input("what to do ")
if ducky == "left":
x6=8
x5=0
print('\033[H\033[J', end='')
Example 2: python naming script text game
# Function gets name from user
def get_name():
print("Hello what is your name?")
name = input("My name is: ")
print("Hello ", name)
return name