Reputation: 103
I am currently making a text based rpg, and to solve the problem of case sensitivity during inputs, I used .upper to make it all uppercase. However, it seems to not work in my code. Can someone please help?
if weapon in normalswords or weapon in fireswords or weapon in airswords or weapon in grassSwords:
if weapon in normalswords:
print (normalswords[weapon])
while y== True:
variable= input("Equip? Yes or No")
variable.upper()
if variable== "YES":
print (weapon, "Equipped")
x= False
y=False
elif variable == "NO":
x= True
else:
print ("That is not a valid answer")
y=True
Upvotes: 0
Views: 325
Reputation: 87084
str.upper()
returns a copy of the string converted to upper case. It does not modify the string inplace because strings are immutable in Python.
Try this:
variable = variable.upper()
Upvotes: 3