Skip to content

Instantly share code, notes, and snippets.

@yuheiomori
Created August 28, 2014 11:15
Show Gist options
  • Save yuheiomori/4b2141cdf7b274a79f93 to your computer and use it in GitHub Desktop.
Save yuheiomori/4b2141cdf7b274a79f93 to your computer and use it in GitHub Desktop.
Tarailing String(CodeEval) in python 3.x
# coding=utf-8
import sys
def trailing_string(a, b):
if a.endswith(b):
return 1
else:
return 0
def main():
with open(sys.argv[1], "r") as f:
for line in f:
line = line.rstrip()
if line:
print(trailing_string(*line.split(',')))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment