Skip to content

Commit

Permalink
Add python solution
Browse files Browse the repository at this point in the history
  • Loading branch information
imulan committed May 17, 2017
1 parent cd25b25 commit 00eb22d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions string/python-correct/SOLUTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8; mode: python -*-

## Solution
#c_solution(src='main.c') # -lm -O2 as default
#cxx_solution(src='main.cc', flags=[]) # -std=c++11 -O2 as default
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main')
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main', challenge_cases=[])
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main', challenge_cases=['10_corner*.in'])
#script_solution(src='main.sh') # shebang line is required
#script_solution(src='main.pl') # shebang line is required
script_solution(src='main.py') # shebang line is required
#script_solution(src='main.rb') # shebang line is required
#js_solution(src='main.js') # javascript (nodejs)
#hs_solution(src='main.hs') # haskell (stack + ghc)
#cs_solution(src='main.cs') # C# (mono)

## Score
#expected_score(100)
19 changes: 19 additions & 0 deletions string/python-correct/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

def solve():
s,k = input().split()
k = int(k)

if k > len(s):
return '*'
else:
return s[k-1]

def main():
cases = int(input())
for _ in range(cases):
print(solve())

if __name__ == '__main__':
main()

0 comments on commit 00eb22d

Please sign in to comment.