I am new to programming and trying to solve the question and this is where I came but still it is not passing any of the test cases. this is the program I wrote in python