Answer to Question #305369 in Python for Rajesh

Question #305369

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

229 390

Sample Output1

Hard


Sample Input2

123456789 9876543218

Sample Output2

Easy


1
Expert's answer
2022-03-03T09:59:56-0500
a = str(input("Enter first  number: "))
b = str(input("Enter second number: "))


l1=len(a)
l2=len(b)
n=l1-1
s=""
if(l1<l2):
    for r in range(0,l2-l1):
        s=s+"0"
if(l1>l2):
    for r in range(0,l1-l2):
        s=s+"0"
        
s1=""
s2=""
if(l1<l2):
    s1=s+str(a)
    s2 = b 
if(l1>l2):
    s1=s+str(b)
    s2 = a
if(l1==l2):
    s1=a
    s2=b

Flag=1
for r in range(0,len(s1)):
    if(int(s1[r])+int(s2[r])>9):
        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