""" Allow reinput of lines of data
    Single 'e' or 'q' as line is not allowed, except 'q' in edit mode is OK

    For daniweb.com by Tony Veijalainen, user pyTony
"""

# Make to work in Python 2 and Python 3
from __future__ import print_function
try:
    input = raw_input
except:
    pass

data = []
line = ''
while True:
    line = input('Enter a datum {}: '.format(len(data)+1))
    if line == 'q':
        break
    elif line == 'e':
        print('Edit mode, "e" exits edit mode, empty line leaves unchanged.')
        for lineno, line in enumerate(data, 1):
            print(lineno, ':', line)
            line = input('e> ')
            if line == 'e':
                break
            else:
                if not line:
                    print('Not changing')
                else:
                    data[lineno-1] = line
        print('Exiting edit mode, now lines are:')
        print(*data, sep='\n')
    else:
        data.append(line)
    
    
print('You input {} data lines:'.format(len(data)))
print(*data, sep='\n')

""" Example session:
Enter a datum 1: 42
Enter a datum 2: 43
Enter a datum 3: d
Enter a datum 4: e
Edit mode, "e" exits edit mode, empty line leaves unchanged.
1 : 42
e> 
Not changing
2 : 43
e> 
Not changing
3 : d
e> 76
Exiting edit mode, now lines are:
42
43
76
Enter a datum 4: 65
Enter a datum 5: y
Enter a datum 6: 43
Enter a datum 7: 23
Enter a datum 8: e
Edit mode, "e" exits edit mode, empty line leaves unchanged.
1 : 42
e> 
Not changing
2 : 43
e> 
Not changing
3 : 76
e> 
Not changing
4 : 65
e> 
Not changing
5 : y
e> 98
6 : 43
e> e
Exiting edit mode, now lines are:
42
43
76
65
98
43
23
Enter a datum 8: 221
Enter a datum 9: q
You input 8 data lines:
42
43
76
65
98
43
23
221
"""

Specialties:
IT/Science/Contracts/Religious translation/interpreting FIN-ENG-FIN
Python programming

thanks pytony for the code , I have written a program for my own business but it lacked a code like yours . with your permission I will use it .

thanks again pytony , I can use the above code too and do not worry , I will not claim it as my own

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.