Every time I input a request I get an error saying the request was not found. Does anyone know what the problem is?
def get_elem(req):
for element in elements_dict:
if req.upper() == element:
return elements_dict[element]
else:
return "Element not found, check spelling and try again."
def InOut():
req = input(
"What element would you like to know the molar mass of? (E.x. Lithium would be LI): ")
print(get_elem(req))
InOut()
I thought that having the .upper() would make sure that all inputs would match the syntax of my dictionary. The dictionary syntax is like: {'CL': 35.45}