OneBite.Dev - Coding blog in a bite size

use a conditional to check greater than number in python

Code snippet on how to use a conditional to check greater than number in python

number1 = 5
number2 = 2

if number1 > number2:
  print("number1 is greater than number2")

This code uses a conditional statement to check if one value, in this case number1, is greater than another value, in this case number2. First, the two numbers are defined and assigned a value, with number1 as 5 and number2 as 2. Then, the code checks to see if number1 is greater than number2 using an if statement. Finally, if number1 is greater than number2, the statement ‘number1 is greater than number2’ is printed.

python