📜  python 以模式打印字符串名称 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:01.208000             🧑  作者: Mango

代码示例1
j="ramkumar"
for i in range(len(j)):
    for g in range(0,i+1):
        print(j[g],end=' ')
    print('')
# end='' meaning (print the next answer , near the previous answer in same line)
#answer 1 2 3 4 5 6 like this in same row or same line(in horizontal)



name="ramkumar"
for i in range(len(name)) :
    print(name[0:i+1])