Write a Python program that will ask the user to input a string (containing exactly one word). Then your program should print subsequent substrings of the given string as shown in the examples below.
def subString(string):
for n in range(1,len(string) + 1):
for i in range(len(string) - n + 1):
j = i + n - 1
for k in range(i,j + 1):
print(string[k],end="")
print()
subString('David')
D
a
v
i
d
Da
av
vi
id
Dav
avi
vid
Davi
avid
David
Comments
Leave a comment