Logical Operators


Source Code : 1

number_1	=int(input("Enter First value : "))
number_2 	=int(input("Enter Second Value : "))
number_3 	=int(input("Enter Third Value : "))

print("Logical AND Example ")
if((number_1 > number_2 ) and (number_3 > number_2 )) :
	print("First and Third Value is Greater than Second Value")
elif((number_2 > number_1 ) and (number_3 > number_1 )) :
    print("Second and Third Value is Greater than First Value")
else:
    print("Condition not Satisfied...!")
    
To download raw file Click Here

Output : 1

Enter First value : 30
Enter Second Value : 20
Enter Third Value : 40

Logical AND Example
First and Third Value is Greater than Second Value

Source Code : 2

number_1	=int(input("Enter First value : "))
number_2 	=int(input("Enter Second Value : "))
number_3 	=int(input("Enter Third Value : "))

print("Logical OR Example ")
if((number_1 > number_2 ) or (number_3 > number_2 )) :
	print("Second Number is less than First or Third Number")
elif((number_2 > number_1 ) or (number_3 > number_1 )) :
    print("First Number is less than Second or Third Number")
else:
    print("Condition not Satisfied...!")
    
To download raw file Click Here

Output : 2

Enter First value : 50
Enter Second Value : 20
Enter Third Value : 40

Logical OR Example
Second Number is less than First or Third Number