else statements

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 else statements:
a = int(input())
b = int(input())

if a == b:
	print('YES')
else:
	print('NO')
This program prints YES if the inputted two values match, and NO otherwise.
Note that the contents of both if and else statements 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:
Comparison operator
Example
Description
==
if a == b:
Is a equal to b?
!=
if a != b:
Is a different from b?
<
if a < b:
Is a less than b?
>
if a > b:
Is a greater than b?
<=
if a <= b:
Is a less than or equal to b?
>=
if a >= b:
Is a greater than or equal to b?

Challenge

Given two numbers, print the maximum out of those.
Input
Output
10 54
54
7 5
7
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue