Click here to Skip to main content
14,733,443 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Write a function that takes two strings S1 and S2 , and returns the position index of S2 in S1 . If S2 does not exist in S1 , then the function returns -1 .

What I have tried:

I have tried some other ways and they didn’t work
Posted
Updated 10-Nov-20 2:59am
Comments
Patrice T 10-Nov-20 10:44am
   
Show your work

See The Python Tutorial — Python 3.7.9 documentation[^]. This is not a particularly difficult assignment and the tutorials will give you many good examples.
   
Comments
CPallini 10-Nov-20 7:57am
   
5.
I wonder if a little googling could help....
How to Check if a Python String Contains Another String? - Afternerd[^]
   
Comments
Richard MacCutchan 10-Nov-20 8:16am
   
See my latest in the Lounge.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900