I have a problem concerning of changing mark. I don´t understand why it doesn´t work...thought the old_mark is type LIST. It works for one student and not for more (for loop) Pls can you help me?
Thanks Vlady

def change_mark(changed_mark):
    for student in changed_mark:
        old_mark[position] = raw_input('new_mark')
        print changed_mark

## approach for one student:

##    old_mark=changed_mark['vlado']
##    position = old_mark.index('a')
##    old_mark[position] = raw_input('new_mark')
##    print changed_mark

def main():
    changed_mark={'vlado': [u'a'], 'juraj': [u'b'], 'alica': [u'c'], 'peto': [u'a'],
    'natalia': [u'b'], 'roman': [u'c'], 'kristina': [u'a'], 'silvia': [u'b']}

if __name__ == '__main__':

Recommended Answers

All 3 Replies

[I][B]position=old_mark.index[old_mark][/B][/I]  # are you sure old_mark has an index....?

I'm not sure what you're trying to do here, but remember you can always replace the value in a dictionary pair by doing:

dic[old_key] = new_value

Good luck :-)

thanks! but I knew that...

OK - did you see you have an error?
If you could describe what you're trying to do, I might be able to assist you better.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.