Skip to main content
improve formatting
Source Link
wjandrea
  • 34k
  • 10
  • 69
  • 105

Just to build up on the answer above, to get the correct output that you expect from the if statement you need to specify if "z" in string and "s" in stringif "z" in string and "s" in string in order for python to compute the correct meaning of what you intend it to do.

 string = 'asdf' if 'z' in string and 's' in string: print("True") else: print("False") 

Just to build up on the answer above, to get the correct output that you expect from the if statement you need to specify if "z" in string and "s" in string in order for python to compute the correct meaning of what you intend it to do.

 string = 'asdf' if 'z' in string and 's' in string: print("True") else: print("False") 

Just to build up on the answer above, to get the correct output that you expect from the if statement you need to specify if "z" in string and "s" in string in order for python to compute the correct meaning of what you intend it to do.

 string = 'asdf' if 'z' in string and 's' in string: print("True") else: print("False") 
Source Link
Σ baryon
  • 246
  • 1
  • 12

Just to build up on the answer above, to get the correct output that you expect from the if statement you need to specify if "z" in string and "s" in string in order for python to compute the correct meaning of what you intend it to do.

 string = 'asdf' if 'z' in string and 's' in string: print("True") else: print("False")