Answer to Question #305780 in Python for Rikki

Question #305780

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



1
Expert's answer
2022-03-03T19:07:50-0500
 det_add(a, b):
    n = len(a) - 1
    s = ''
    if len(a) < len(b):
        for r in range(0, len(blen(a)):
            s = s + '0'
    if len(a) > len(b):
        for r in range(0, len(a) - len(b)):
            s = s + '0'
    s1 = ''
    s2 = ''
    if len(a) < len(b):
        s1 = s + str(a)
        s2 = b
    if len(a) > len(b):
        s1 = a
        s2 = b
    flag = 1
    for r in range(0, len(s1)):
        if int(s1[r]) + int(s2[r]) > a:
            flag = 0
    if flag == 1:
        print('easy)
    if flag == 0:
        print('hard)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS