Answer to Question #257977 in Python for skipmakliw

Question #257977

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!


Anyone knows how to do this on python, I'm starting to learn but got stuck on this prob.

Any solutions are appreciated


1
Expert's answer
2021-10-28T06:58:50-0400
n=int(input("Enter 3-digit number: "))
no=str(n)
if no[0]==no[1] and no[2]==no[0]:
    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