0

There are few methods are written which perform some of the tasks and return the string value.

def method1():
  #stuffs
  return string

def method2():
  #stuffs
  return string

def method3():
  #stuffs
  return string 

outm1 = method1()
outm2 = method2()
outm3 = method3()

Now I want to perform the condition work to check whether 2 out of 3 above variable string value is same, if so I need to print that value otherwise will print different value.

I am aware that if the methods are returning True or False then we can do with below way,

if sum([outm1 , outm2 , outm3]) >= 2:
  #do stuffs

but not sure how to perform with string values...

Karthi1234
  • 949
  • 1
  • 8
  • 28
  • You can refer this question: http://stackoverflow.com/questions/2643850/what-is-a-good-way-to-do-countif-in-python – Vej Apr 13 '17 at 03:00
  • Possible duplicate of [What is a good way to do countif in Python](http://stackoverflow.com/questions/2643850/what-is-a-good-way-to-do-countif-in-python) – Vej Apr 13 '17 at 03:01

0 Answers0