I have a def function looks like:
def update(marks, num, mark, column):
lines = [l for l in marks]
for row in range(len(all_marks)):
if all_marks[row][0] == num:
lines[row][column] = mark
elif lines[row][column] != '':
print num + ' already has a value in column - update ignored.'
and raw_input function inside another def function looks like:
result1 = raw_input('Enter results file: ')
num = raw_input('Student number (empty to finish): ')
if len(snumber) == 0:
print
print
print 'finished'
print
print
return interact()
else:
pass
column2 = raw_input('Enter column: ')
newresult1 = raw_input('New result: ')
try:
print update(result1, snumber, newresult1, column2)
except IOError:
print 'Try again'
The third line from the bottom supposed to print def update(marks, num, mark, column) but it keeps returning none.
Sorry, the codes are a bit messy.
Can anyone let me know what I have done wrong?
Thanks in advance.
Your
updatefunction doesn’t look like it returns anything. You need to explicitly return something or there won’t be a return value.