In pdb (or ipdb) we can execute statements and evaluate expressions with the ! or p commands:
p expression
Evaluate the
With regards to your example, you don't need to exit pdb and change the code. You can step into the function (with 's') and set weekday_index=0 inside.
One solution to your original problem is to use the debugger's jump command as follows:
This worked when I tried it, but the debugger complained when I tried to do step 3 before step 2 for some reason.