In next video I'll tell you better solution
Python Debugger with Examples - Functions & Command Prompt - DataFlair
Python Problem 8: Solution | Python Tutorials For Absolute Beginners In Hindi #118
DRY principle of coding : Python tutorial 66
Find and Replace Method : Python tutorial 34
Python 3 Tutorial for Beginners #21 - List Comprehensions