0

I need to check if an input has two specific words in it, if it does i need to replace them with other words, they both have to be replaced in the same instance, i can replace each of them but i don't know how to make a list to check for more than one word at the same time, my try.

    n = input('Line: ')                                                     
    if 'Seraphina' in n:                                            
      n1 = n.replace('Seraphina', 'Emilia')                
      print(n1)                                             
    elif 'Rufus' in n:                                     
      n2 = n.replace('Rufus', 'Ravi')              
      print(n2)               
    else:                                                          
      print(n)                                                        

I know that the problem is that the elif checks after the first if would be false, pretty much my question is how do i check for more than one word at once.

Elijah
  • 49
  • 6

0 Answers0