I frequently see the same problem on a 6th-generation iPod Touch.
I think it's running iOS 10.3.2.
It's using a version of Pythonista 3 downloaded shortly before November 29, 2017.
The keyboard is a Verbatim folding keyboard. I don't remember the model number.
I'd save frequently, except that I'm not sure how to force an explicit save.