I'm trying to make a text game in python that's basically about exploring a fake hard drive through a CMD line. I'm experimenting with having the different subfolders saved in the code as different subroutines. Long story short I'm trying to make it so that you can call a subroutine from a variable name? Does anyone know if this is possible in python 3.6.3? Here's a test program to show my concept. Can anyone get this to work?
def level1():
print("you have reached level 1")
def level2():
print("you have reached level 2")
lvl = int(input("go to level: "))
lvl = str(lvl)
level = str("level"+lvl)
level()
Thanks for any help, -Rees :)