my_data="BEAR"
for i in range(len(my_data)):
print(my_data[:len(my_data)-i]) #trick is here
Output:
BEAR
BEA
BE
B
2
solved How do you print one fewer letters each time? [closed]
my_data="BEAR"
for i in range(len(my_data)):
print(my_data[:len(my_data)-i]) #trick is here
Output:
BEAR
BEA
BE
B
2
solved How do you print one fewer letters each time? [closed]