Construct a 6 input gate which performs the following logical operation:
 (not(A)).B + C.D +E.(not(F))
where A, B, C, D, E and F are the inputs to the 6 input gate.
Example 1:
Input: A = 1, B = 1, C = 0
       D = 0, E = 1, F = 1
Output: 0 
Explanation: (not(A)).B + C.D +E.(not(F))
= (not(1)).1 + 0.0 +1.(not(1)) = 0.
Example 2:
Input: A = 1, B = 1, C = 1
       D = 1, E = 1, F = 1
Output: 1
Explanation: (not(A)).B + C.D +E.(not(F))
= (not(1)).1 + 1.1 +1.(not(1)) = 1.
Your Task:  
You dont need to read input or print anything. Complete the function logicalOperation() which takes A, B, C, D, E, F as input parameter and returns the result after executing the given opearation.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
0 <= A,B,C,D,E,F <= 1

Source: geeksforgeeks | Difficulty: EASY
Tags: Bit manipulation

Data structures

Starter code: #User function Template for python3

class Solution:
    def logicalOperation (self, A, B, C, D, E, F):
        # code here 

Solutions:
class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		if (not A) * B + C * D + E * (not F) == 0:
			return 0
		return 1


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		a = True
		b = True
		c = True
		d = True
		e = True
		f = True
		if A == 0:
			a = False
		if B == 0:
			b = False
		if C == 0:
			c = False
		if D == 0:
			d = False
		if E == 0:
			e = False
		if F == 0:
			f = False
		v1 = not a and b
		v2 = c and d
		v3 = e and (not f)
		result = v1 or v2 or v3
		if result:
			return 1
		return 0


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		if not A and B or (C and D) or (E and (not F)):
			return 1
		else:
			return 0


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		return ~A & B | C & D | E & ~F


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		(t1, t2, t3) = (not A and B, C and D, not F and E)
		return int(t1 or t2 or t3)


class Solution:

	def knot(a):
		if a == 1:
			return 0
		else:
			return 1

	def dot(a, b):
		return a and b

	def logicalOperation(self, A, B, C, D, E, F):
		sum = (Solution.knot(A) and B) + (C and D) + (E and Solution.knot(F))
		if sum >= 1:
			return 1
		else:
			return 0


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		return self.orGate(self.orGate(self.andGate(self.notGate(A), B), self.andGate(C, D)), self.andGate(E, self.notGate(F)))

	def notGate(self, x):
		if x:
			return 0
		else:
			return 1

	def andGate(self, x, y):
		if x and y:
			return 1
		else:
			return 0

	def orGate(self, x, y):
		if not x and (not y):
			return 0
		else:
			return 1


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		a = not A and B
		b = C and D
		c = E and (not F)
		d = a or b or c
		if d:
			return 1
		else:
			return 0


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		return int(bool((not A) * B + C * D + E * (not F)))


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		return int(not A and B or (C and D) or (E and (not F)))


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		CD = C * D
		A = 1 if A == 0 else 0
		F = 1 if F == 0 else 1
		EF = E * F
		AB = A * B
		ABCD = 1 if AB == 1 or CD == 1 else 0
		ABCDEF = 1 if ABCD == 1 or EF == 1 else 0
		return ABCDEF


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):

		def op_not(n):
			if n == 1:
				return 0
			else:
				return 1

		def op_dot(a, b):
			if a == 0 and b == 0:
				return 0
			elif a == 0 and b == 1:
				return 0
			elif a == 1 and b == 0:
				return 0
			elif a == 1 and b == 1:
				return 1

		def op_or(a, b):
			if a == 0 and b == 0:
				return 0
			elif a == 0 and b == 1:
				return 1
			elif a == 1 and b == 0:
				return 1
			elif a == 1 and b == 1:
				return 1
		temp = op_or(op_dot(op_not(A), B), op_dot(C, D))
		return op_or(temp, op_dot(E, op_not(F)))


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		a = (not A) * B
		b = C * D
		c = E * (not F)
		return a or b or c


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		res = not A and B or (C and D) or (E and (not F))
		if res == True:
			return 1
		if res == False:
			return 0


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		X = not A
		Y = X * B
		Z = C * D
		T = not F
		S = E * T
		Final = Y + Z + S
		if Final == 0:
			return 0
		return 1


class Solution:

	def logicalOperation(self, A, B, C, D, E, F):
		j = (not A) * B or C * D or E * (not F)
		return j