Menu Close

Relational operator Question

Chef has started programming. He is reading about relational operators. Relational operators are operators which check relationship between two values. Given two numerical values A nad B you need to help chef in finding hte relationship between them. I.e First one is greater than second one or first one is less than second one or they both are equal. Using T number of cases and using while loop and if/else condition.

T=int(input("Enter the no: of cases: "))
n=0
while(T!=0):
	A=int(input("Enter the first number: "))
	B=int(input("Enter the second number: "))
	n+=1
	if A>B:
		print("Case {}'s relational operator: >".format(n))
	elif A<B:
		print("Case {}'s relational operator: <".format(n))
	else:
		print("Case {}'s relational operator: =".format(n))
	T-=1
	print()

Output:

Enter the no: of cases: 3

Enter the first number: 2
Enter the second number: 3
Case 1’s relational operator: <

Enter the first number: 2
Enter the second number: 3
Case 2’s relational operator: <

Enter the first number: 1
Enter the second number: 1
Case 3’s relational operator: =


Morae!Q!

->Insert and Extend in list python
->Print Odd Numbers in range
->Compare List in python
->Find whether the largest element in the array is at least twice as much as every other number in the array.
->Find minimum cost to reach the top of the floor
->Word Count in Python
->Lower case to upper case in python
->Display Time in python
->Sum of Odd And Even in Python
->Surface Area of Walls
->Find the sum of squares of individual digits
->Print the given series – 1 1 2 6 24
->Minimum number of steps required to reach destination.
->Seconds to Days Hours Minutes
->Program to remove add “Hyphen” character in the entered string
->Remove the nth Index Character from a Non-Empty String
->Relational operator Question
->Check whether all the given numbers lies in range of x and y.
->Find the Armstrong numbers between the given range.