Question

Why is my IF-ELIF-ELSE loop always giving the else condition statement

  • 6 October 2021
  • 3 replies
  • 113 views

I have a set of email ids mapped to certain states but unfortunately any state I key in, it automatically goes to else condition. I have it compiled in python compiler but for some reason doesn’t work that way in Zapier.
Anybody has any idea where I am going wrong?


if input_data in ["Assam","Manipur","Meghalaya","Sikkim","West Bengal","Bihar","Chattishgarh","Jharkhand","Orissa","Telangana","Madhya Pradesh","Andhra Pradesh"]:
        return {"email" : xxxxxxx@xxxxx.com}
elif input_data in ["Delhi","Haryana","Himachal Pradesh","Jammu & Kashmir","Punjab","Rajasthan","Uttar Pradesh","Uttarakhand"]:
        return {"email":"xxx.xx@xxxxx.com"}
elif input_data in ["Maharashtra","Gujarat","Goa","Daman & Diu","Dadra & Nagar Haveli"]:
        return {"email":"xxxxxxx@xxxxx.com"}
elif input_data in ["Karnataka","Tamil Nadu"]:
        return {"email":"xxxxxxxx@xxxxx.com"}
elif input_data == "Kerala":
        return {"email":"xxxxxxxx@xxxxx.com"}
else:
        return{"email":"xxxxx@xxxx.ai"}
    
output = print({"email":getState(input_data)})

 

 

This post has been edited by a moderator to remove sensitive information. Please remember to obfuscate any personally identifiable information prior to posting as this is a public forum. 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 6
Badge +6

Hey @Harini95 , What is the state name in the input value?

@jayeshkumarbhatia I used Assam as input. But any of the inputs among the states defined I give, it returns the same email ID.

Userlevel 6
Badge +6

Can you show me the screenshot of your code by zapier step? I want to see how did you setup input data.