''' Robogame https://w...content-available-to-author-only...f.com/problems/ROBOGAME ''' import re fin = open("robots-big.txt", "r") fout = open("robots-big-solved-function.txt", "a") counter = 1 def check_robots(string): p = re.compile("[0-9]") c = () for m in p.finditer(string): c += (m.start(), m.group()) if len(c) <= 2 or c[1] == str(0) and c[3] == str(0): return (" safe: " + line) d = (c[2]-c[0])-1 if d <= int(c[1]) or int(c[3]): return (" unsafe: " + line) else: return (" safe: " + line) for line in fin: fout.write(str(counter)) fout.write(check_robots(line)) counter += 1 elapsed = end_time - start_time print(elapsed) fout.write(str(elapsed)) fin.close() fout.close()
Standard input is empty
Standard output is empty
Traceback (most recent call last): File "./prog.py", line 10, in <module> fin = open("robots-big.txt", "r") FileNotFoundError: [Errno 2] No such file or directory: 'robots-big.txt'
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!
Home
API
Language
FAQ
Credits
desktop
mobile
Terms of Service
Privacy Policy
GDPR Info
Popular languages:
Bash
Pascal
C
Perl
C#
PHP
C++
Python
C++14
Python3
Haskell
Ruby
Java
SQLite
Objective-C
Swift
VB.net
List of all supported programming languages