164k views
3 votes
Write a program that reads two integers, checks if a digit repeats 3 times in a row in the first integer and that same digit repeats two times in a row in the second integer.

1 Answer

5 votes

Answer:

first_num = input("Enter integer digits (should be four or more digits): ")

sec_num = input("Enter integer digits (should be four or more digits): ")

num = '3'

if

def count_check( digit):

if (digit * 3) in first_num and (digit * 2) in sec_num:

print(True)

else:

print(False)

count_check(num)

Step-by-step explanation:

The python source code above receives two values assigned to variables "first_num" and "sec_num" and defines a function called count_check to check if a digit occurs three consecutive times in the first input and two in the second to print a value of true or false otherwise.

User Kirk Sefchik
by
7.3k points