question: Difficult Addition
Arjun is trying to add two numbers. since he has learned addition recently, an addition which requires carry is difficult for him . your task is to print "Easy" if the addition doesn't
involve carry, otherwise print "Hard"
Input 1 :- 229 390
output 1 :- Hard
Input 2 :- 123456789 9876543210
output 2 :- Easy
n=0
while(n!=2):
input1 = (str(input("Enter two numbers separated by space: "))).split(" ")
n = len(input1)
s_1=0
for s in range(0,len(input1[0])):
t1 = int(input1[0][s])
t2 = int(input1[1][s])
if((t1+t2)>9):
s_1=1
if(s_1):
print("HARD")
else:
print("EASY")
Enter two numbers separated by space: 240 300
EASY
Comments
Leave a comment