In some situations, we would like to do certain things if a condition holds, and do something else if it doesn’t. Python allows that through
a = int(input()) b = int(input()) if a == b: print('YES') else: print('NO')
This program prints
YESif the inputted two values match, and
Note that the contents of both
elsestatements are indented with 4 spaces. Besides, both statements end with a colon
Note that checking if two values are equal is done through the double
==sign. A single
=sign is used for assignment, while a double
==sign is used to check if two values are equal.
Here is the list of all the possible comparison conditions available in python:
Given two numbers, print the maximum out of those.
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB