Comparing two integers in Python

Report a typo

Given two integers, num1 and num2, you need to determine whether num1 is greater than, less than, or equal to num2 and assign the result to the variable 'comparison_result'. Fill the blanks in the given code that accomplish this comparison and correctly assign the result. Remember, the valid Boolean comparisons in Python are >, < and ==.

Fill in the gaps with the relevant elements
num1 = 10
num2 = 20
comparison_result = ""

 num1 > num2:
    comparison_result = "num1 is greater than num2"
 num1 < num2:
    comparison_result = "num1 is less than num2"
:
    comparison_result = "num1 is equal to num2"

print(comparison_result)
elififelse
___

Create a free account to access the full topic