-2

If you had two strings,

string1 = "Rahul 123 Mumbai Shivani 234 Mumbai Akash 345 Mumbai Rahul 456 Bangalore"

string2 = "Rahul 123 Mumbai"

How do you find out the difference?

As in, the final output should be -

"Shivani 234 Mumbai Akash 345 Mumbai Rahul 456 Bangalore"

I tried using str.strip(), but it's giving me incorrect answers.

taras
  • 6,566
  • 10
  • 39
  • 50
user10141156
  • 170
  • 7

1 Answers1

2

You could try

string1.replace(string2, '').strip()
SpghttCd
  • 10,510
  • 2
  • 20
  • 25