String Membership in Python

String Membership

You just need to take string and a character as an input from stdin and print 'True' if that character is present in that string otherwise print 'False'.
Input Format
You will be taking a string and a character as an input from stdin.


Constraints
1 <= |S| <= 10000


Output Format
Print 'True' if that character is present in that string otherwise print 'False'.

Sample TestCase 1
Input
Hello Techgig
H
Output
True

Solution:
import sys
def main():

# Write code here
ip1=raw_input()
ip2=raw_input()
length=len(ip1)
for i in range(0,length):
if(ip2==ip1[i]):
sys.stdout.write("True")
break
else:
sys.stdout.write("False")
break

main()

Comments

Popular posts from this blog

Reasoning-Number Series

Reasoning-Letter Series

Profit and Loss