Digit Insurance Interview Question

Basic python codes, design question