Python 3.x 在整数中查找数字序列

Python 3.x 在整数中查找数字序列,python-3.x,Python 3.x,伙计们,这是我的问题: 我试图从用户处读取一个整数(例如12345) 如何检查第一个整数中是否存在模式“34” 我的限制是我不能将其转换为字符串,也不能使用数组 以下是我为打印12345中存在的一些模式而编写的内容: import math int1 = int(input("input an integer: ")) #I used this to find out how many digits are in the integer count = math.ceil(math.log1

伙计们,这是我的问题:

我试图从用户处读取一个整数(例如12345)

如何检查第一个整数中是否存在模式“34”

我的限制是我不能将其转换为字符串,也不能使用数组

以下是我为打印12345中存在的一些模式而编写的内容:

import math

int1 = int(input("input an integer: "))

#I used this to find out how many digits are in the integer
count = math.ceil(math.log10(int1))

for i in range(count): 
    print (int1 % (10 ** (i+1)))

for i in range(count):
    print (int1 // (10 ** (i+1)))

因为这似乎是家庭作业,所以我不提供答案,只提供一个粗略的提示


提示:使用
divmod(n,10)
提取数字的每个数字,它返回n,不带最后一个数字和n的最后一个数字。在变量中保留当前数字和前一个数字,并在每次提取新a数字时将其与模式(
34
)进行比较。

可能的重复。你们应该联系一下,看起来你们在上同样的课。谢谢,看来他的问题和我的一样。