find a character in a String Python
python program to get a String and a character then find where the character occurred first in the string.
Sample Input 1 :
Hello l
Sample Output 1 :
2
Try your Solution
Strongly recommended to Solve it on your own, Don't directly go to the solution given below.
#write your code here
		
		
		
		Program or Solution
			
				
			
					
s=input("Enter a String:")
c=input("Enter a Character:")
for i in range(0,len(s)):
    if(s[i]==c):
        print(i)
        break
else:
    print("Not Found")
			
				
			
		
		
					
		
		
								
		Program Explanation
Visit each location in string s one by one for i in range(0,len(s)): if character c is found, return th location iComments
Related Programs
- length of the string in python
- occurences of character in string python
- lowercase to uppercase in python
- uppercase to lowercase in python
- python count vowels in string
- Compare two Strings in python
- find vowels in string python
- find substring in string pyhton
- occurences of substring in a String python
- Reverse the String in python
- string Palindronme in python
- Remove the spaces in String python
- Remove the Vowels in String Python
                
                coming Soon
                
            
            
                
                coming Soon
            
        
