CODING PRACTICE - 3 Lucky Number

 Lucky Number

Given two integers, they are considered a lucky pair if any one of them is 6 or if their sum or difference is equal to 6.
Input

The first line of input contains a number.
The second line of input contains a number.
Output

If the given conditions are satisfied, print "Lucky". In all other cases, print "Not Lucky".
Explanation

For example, if the given numbers are 6 and 1. One of the given two numbers is 6. So the output should be "Lucky".
Whereas, if the given numbers are 3 and 2, they do not satisfy any of the conditions. So the output should be "Not Lucky".
Sample Input 1
6
1
Sample Output 1
Lucky
Sample Input 2
3
2
Not Lucky
15
9
Sample Output 3
Lucky



code:





a = int(input())
b = int(input())
x=((a==6) or (b==6))
y=((a+b)==6)
z=((a-b)==6) or ((b-a)==6)
c=y or z 
if x or c:
    print("Lucky")
else:
    print("Not Lucky")

Comments

Popular posts from this blog

CODING ASSIGNMENT 4

CODING PRACTICE 11 Music Page

CODING ASSIGNMENT 3