Skip to content

Instantly share code, notes, and snippets.

@poanchen
Created February 5, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poanchen/7a1c072fb4b373ab9e96312349303416 to your computer and use it in GitHub Desktop.
Save poanchen/7a1c072fb4b373ab9e96312349303416 to your computer and use it in GitHub Desktop.
A python script that will create a barebone Java code with the default main class along with testcase1 and printlist functions that are necessary for doing competeive programming questions
import os
i = 12
while os.path.exists("./Solution" + str(i) + ".java"):
i += 1
file_contents = """import java.util.*;
import java.lang.*;
public class Solution%s {
public static void testCase1() {
}
public static void printList() {
}
public static void main(String [] args) {
System.out.println();
}
}""" % (str(i))
os.system('echo "%s" > Solution%s.java' % (file_contents, i))
os.system('open -a Sublime\ Text Solution' + str(i) + '.java')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment