this is my code:
ranking_dict = {}
current_ranking = open("ladder.txt")
a=0
for line in current_ranking:
x = line.rstrip("\n")
a+=1
ranking_dict[int(a)]=x
## query: check if the player is in the ladder
def checkplayer():
username = input("Please input in your name in the format J Tan or JY Tan, where J/JY are the initial(s) of your first name, and Tan is your last name: ")
if username in ranking_dict.values():
print("You are currently in the ladder")
else:
print("You are currently not in the ladder, please register")
username = None
return
## query: list ranking of players
def query_ranking():
for key in ranking_dict:
print(key, " : ", ranking_dict[key])
return
## list of queries
def userqueries():
print ("Please enter in your query:")
print ("Challenge, Check Player, Check Rankings, etc")
query = input(":")
if query == str("Check Player") or str("check player") or str("checkplayer"):
checkplayer()
elif query == str("Check Rankings") or str("check rankings") or str("checkrankings"):
query_ranking()
else:
print ("That was an invalid query")
return
userqueries()
Currently what I'm trying to do is call a different function based on different user inputs. But when I type in anything it immediately calls the first function checkplayer()
. Did I screw up the input recognizing part of the code?