Answer to Question #257472 in Python for Andy

Question #257472

Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".

Let's try this out now!


Input

A line containing two integers separated by a space.

777·7

Output

A line containing a string.

Jackpot!
1
Expert's answer
2021-11-02T17:36:39-0400
numbers = input('Enter integers separated by space:')
numbers2 = numbers[0:3] #split numbers to xheck if first 3 digits are the same
if numbers2.count(numbers2[0] == len(numbers2):
  if numbers[0] == numbers[4]: #checks if the first digit is equal to the 4th digit since we a;ready know the first 3 digits are equal
    print("Jackpot!")
  else:
    print("Nah")
else:
  print("Nah")

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