Answer to Question #270877 in Java | JSP | JSF for leonard

Question #270877

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!


1
Expert's answer
2021-11-25T02:32:26-0500
inputValues=input().split(' ')
digitNumber3=inputValues[0]
number1=inputValues[1]
counter=0
for ​n in digitNumber3: 
    if (number1==n):
        counter+=1
if ​counter==3:
    print("Jackpot!")
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

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS