Difficult Addition
Arjun is trying to add two numbers. Since he has learned addition recently, an addition which requires a carry is difficult for him. Your task is to print Easy if the addition does not involve a carry, Otherwise print Hard.
Input
The first line of input contains two space separated integers A and B.
Output
If the addition does not involve a carry,print Easy, otherwise print Hard.
Explanation
When calculating 229 + 390, we have a carry from the tens digit to the hundreds digit, so the answer is Hard.
Sample Input1
123456789 9876543218
Sample Output1
Easy
Sample Input2
229 390
Sample Output2
Hard
s = input('>')
s = s.split(' ')
n1 = s[0]
n2 = s[1]
carry = False
if len(n1) > len(n2):
n1, n2 = n2, n1
for i in range(len(n1)):
if int(n1[i])+int(n2[i]) > 10:
carry = True
if carry:
print('Hard')
else:
print('Easy')
>229 390
Hard
>123456789 9876543218
Easy
Comments
Leave a comment