Find Python String

Asked 1 weeks ago, Updated 1 weeks ago, 2 views

Write a program that outputs True or False if the string 'Pennsylvania' contains the input string.

Code a='Pennsylvania'

b=input()

print(b.lower() in a.lower())

Or a='Pennsylvania'

b=input()

print(b in a)

I coded, but I don't get 100 points.~ I'd appreciate it if you could answer me.


2022-09-20 08:45

1 Answers

Is it a substring? Is it a subsequence? Based on your questions, it's not a substring I think it's a subsequence.

a="Pennsylvania", b="Psy" ramen It won't pass when it's a substring, When it's subsequence, it has to pass.

Google for "Longest Common Subsequence" I don't think it's a bad idea to search and point it out at this time. (If you're busy, there's nothing you can do. :)


2022-09-20 08:45

If you have any answers or tips


© 2022 pinfo. All rights reserved.