I have a for loop that iterate through the rows of dataframe containing some texts and shows the user texts associated with specific indices. The users should provide some labels to the text in each iteration of the loop.
As some of the texts presented to the users are long, before going to the next text, I want to clear screen such that each text is shown individually on the screen. I was doing some tests with the code below which simulates my problem, but I did not get the expected result:
import os
from time import sleep
list_texts=['a','b','c','d','e','f','g']
for i in list_texts:
print(i)
l=input('Please, enter labels here: ')
sleep(2)
clear()
u=input('Continue? y/n: ')
if u == 'y':
continue
else:
print('See you later')
break
My desired output is the text a + the question 'Please, enter labels here: ' without the previous output. Thanks in advance for any help.