Also, if you have saved a python script called myScript.py and downloaded
an input file called myData.in then you can run from the command line

myScript.py < myData.in > myOutput.out

On Fri, Apr 3, 2015 at 7:21 AM, ambreen haleem <ambreen2...@gmail.com>
wrote:

> I don't write in python much, but there are online tutorials on file
> processing.
> E.g. to write output you can do as follows:
>
> myfile=open("output.txt",'w')
> myfile.write("string to write")
>
> to read the file
>
> rfile=open("input.txt",'r')
> content = rfile.read()
>
> And you can change the first parameter in the open to the name of the
> input file you downloaded from the problem page. Where is the link to
> broken watch?
>
> link to reading/writing to file :
> http://learnpythonthehardway.org/book/ex16.html
>
>
>
> On Thu, Apr 2, 2015 at 11:06 PM, SYED FAHD <sforsyed...@gmail.com> wrote:
>
>> I'm actually stuck in using command line tool and can you tell me how can
>> i run my program against an input file and generate an output file in
>> python.
>>
>> On 3 April 2015 at 00:35, Carlos Guia <carlos.guia.v...@gmail.com> wrote:
>>
>>> You have to download the input file, run your program against it to
>>> generate the output file and submit that output file. The judge will
>>> determine the correctness based on your output file.
>>>
>>> During practice mode, that's all you have to do. It will tell you if
>>> it's correct or not.
>>>
>>> During a live contest, you'll also have a way to (and will be required
>>> to) upload your source code along with your output file.
>>>
>>> For now concentrate in being able to download input, use your code to
>>> produce an output file and submit it. The qualification round is long
>>> enough for you to see how the source code is uploaded, but it should pretty
>>> straightforward once you've practiced (it's basically just like the one for
>>> the output file). Be sure to upload the source code and output file to the
>>> correct fields though.
>>>
>>> Carlos Guía
>>>
>>> On Thu, Apr 2, 2015 at 12:23 AM, sforsyed158 <sforsyed...@gmail.com>
>>> wrote:
>>>
>>>> here is my code for problem broken watch using python
>>>>
>>>> N = int(raw_input())
>>>> for Z in range(1,N+1):
>>>>     A =
>>>> [[1,1,1,1,1,1,0],[0,1,1,0,0,0,0],[1,1,0,1,1,0,1],[1,1,1,1,0,0,1],[0,1,1,0,0,1,1],[1,0,1,1,0,1,1],[1,0,1,1,1,1,1],[1,1,1,0,0,0,0],[1,1,1,1,1,1,1],[1,1,1,1,0,1,1]]
>>>>     b = raw_input()
>>>>     B = []
>>>>     for i in range(int(b[0])):
>>>>         B.append([])
>>>>     w = 0
>>>>     for i in b[2:]:
>>>>         if i == " ":
>>>>             w +=1
>>>>         else:
>>>>             B[w].append(int(i))
>>>>     Must = [0,0,0,0,0,0,0]
>>>>     for i in B:
>>>>         for r in range(7):
>>>>             if i[r] == 1:
>>>>                 Must[r] = 1
>>>>             else:
>>>>                 pass
>>>>     def MustMatch(l1,l2):
>>>>         result = True
>>>>         for i in range(7):
>>>>             if Must[i] == l2[i] ==1 and l2.count(1) >= l1.count(1):
>>>>                 if l1[i] == 1:
>>>>                     pass
>>>>                 else:
>>>>                     result = False
>>>>             if l1[i] == 1:
>>>>                 if l2[i] == 1:
>>>>                     continue
>>>>                 else:
>>>>                     result = False
>>>>         return result
>>>>     def Matches(l1,l2):
>>>>         result = 0
>>>>         for i in range(len(l1)):
>>>>             if l1[i] == 1 == l2[i]:
>>>>                 result +=1
>>>>         return result
>>>>     def GSI(l):
>>>>         li = l[:]
>>>>         result = []
>>>>         for i in range(len(li)):
>>>>             m = li.index(min(li))
>>>>             result.append(m)
>>>>             li[m] = ""
>>>>         return result[::-1]
>>>>     ANS = "ERROR!"
>>>>     S = []
>>>>     w = 0
>>>>     while w < len(B):
>>>>         if w == 0:
>>>>             s = []
>>>>             scores = []
>>>>             for i in range(10):
>>>>                 if MustMatch(B[w],A[i]) == True:
>>>>                     scores.append(Matches(B[w],A[i]))
>>>>                 else:
>>>>                     scores.append(0)
>>>>             s = GSI(scores)
>>>>             for i in s:
>>>>                 if scores[i] > 0:
>>>>                     S.append(i)
>>>>         else:
>>>>             s = []
>>>>             scores = []
>>>>             for i in S:
>>>>                 if MustMatch(B[w],A[i-w]) == True:
>>>>                     scores.append(Matches(B[w],A[i-w]))
>>>>                 else:
>>>>                     scores.append(0)
>>>>             for i in range(len(S)):
>>>>                 if scores[i] > 0:
>>>>                     s.append(S[i])
>>>>             S = s
>>>>         w+=1
>>>>     if len(S) == 1:
>>>>         ANS = ""
>>>>         for i in range(7):
>>>>             if Must[i] == 1:
>>>>                 ANS = ANS+str(A[S[0]-w][i])
>>>>             else:
>>>>                 ANS = ANS+str(0)
>>>>     print "Case #%i: %s" % (Z,ANS)
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to google-code+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/google-code/c0188ece-7fdf-45e2-8780-6083b3b35b06%40googlegroups.com
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-code/CANxkOGZBB9Pd-S8AU0UJ-Oq3iv4EXcQ3ga0X27Yv74S1FOgAcQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/google-code/CANxkOGZBB9Pd-S8AU0UJ-Oq3iv4EXcQ3ga0X27Yv74S1FOgAcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/CAArbJPOKznpKrSnBr_KcbWKOs93cE9_YBmhU8v1rYa-N6ZXSGw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/google-code/CAArbJPOKznpKrSnBr_KcbWKOs93cE9_YBmhU8v1rYa-N6ZXSGw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAPbSboLj7sgn5xvMOCKmY1EWaQHhecQMOrnBMQaTyqqA7ebAhA%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-code/CAPbSboLj7sgn5xvMOCKmY1EWaQHhecQMOrnBMQaTyqqA7ebAhA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAECKw-NDfaL54UtL0cv%3Dh4UvqwQ0%2B_voEjiKxK5U7jT9gBm9qA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to