python - How to check a variable against 2 different strings? 9 line example -
why doesn't work?
rank=input("is realm duchy, kingdom or empire? ") if rank=="duchy"or"duchy": realm=input("what duchy named? ") elif rank=="kingdom"or"kingdom": realm=input("what kingdom named? ") elif rank=="empire"or"empire": realm=input("what empire named? ") else: print("restart , duchy, kingdom or empire. ")
no matter answer, asked duchy named.
it's evaluating if "dutchy"
, returns true
you need
if rank=="duchy"or rank == "duchy":
or better yet,
if rank.lower() == "duchy":
Comments
Post a Comment