杨辉三角,我不知道哪里出问题了,没有报错,如何解决?(语言-python)

我写的是杨辉三角,没有报错,但是没有接着运行了,不知道哪里出了问题

sh = int(input())
lo = []
list_st = []
flag = True
while True:
    if len(list_st) == 0:
        list_st.append(1)
    else:
        for i in range(len(list_st)):
            if list_st[i] == sh:  # 遍历列表中的元素,找到符合的就输出是第几个,并跳出循环
                print(i + 1)
                flag = False
                break

        if not flag:
            break  # 跳出多个循环
    # 构建杨辉三角
    list_st.append(1)  # 定义了两个列表,list_st是用来存放杨辉三角的地方
    lo.append(1)  # 列表lo是用来存放list_st杨辉三角最新一行之前的数
    if len(list_st) == 2:
        list_st.append(1)
        lo.append(1)
    else:
        for k in range(len(lo)-1, len(list_st) - 2):#生成杨辉三角里面的数字
            list_st.append(list_st[k] + list_st[k + 1])
            lo.append(list_st[k] + list_st[k + 1])
        list_st.append(1)
        lo.append(1)
不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^