Shakiib
Shakiib

Reputation: 57

how to print subsequently in python

I want to print the inputted string subsequently. My code:

text = input()
for i in text:
    print(i)

Input:

ENG

My output:

E
N
G

The output I want:

E
EN
ENG

Upvotes: 0

Views: 64

Answers (2)

Shakib
Shakib

Reputation: 27

This code should work:

for i in range(len(text)):
    print(text[:i+1])

Upvotes: 0

Mig B
Mig B

Reputation: 647

This should solve your problem:

for i in range(len(text)):
    print(text[:i+1])

Upvotes: 1

Related Questions