I need to check the value of all 3 variables(username, password, secret). If a value is NA then I need to execute a print statement or else some condition needs to be executed.
Example 1: username = person1 password = pass1 secret = NA Example 2: username = person1 password = pass1 secret = secret1
Example
#value = Check all 3 variables for NA value if value is NA: print("NA Block") else: print("Value Block") #Calling some function
How to check the value of those variables all at once?
Advertisement
Answer
You could use the in
operator to check whether a value is "NA"
. Like so:
if "NA" in (username, password, secret): print("NA Block") else: print("Value Block") #Calling some function