Skip to content

Instantly share code, notes, and snippets.

@ajayyy
Created October 15, 2019 17:58
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 ajayyy/bb114e8335078b36d13c134f6bec1b9d to your computer and use it in GitHub Desktop.
Save ajayyy/bb114e8335078b36d13c134f6bec1b9d to your computer and use it in GitHub Desktop.
Converts the sample tests into runnable commands for ITI 1120.
# These lines will get the inputs cleaned from
important_lines = [">>> "]
# Used if there is an input on the line after this
important_proceeding_lines = []
raw = ""
while True:
current_input = input()
if current_input == "DONE":
break
raw += current_input + "\n"
cleaned = ""
check_next_line = False
for line in raw.split("\n"):
if check_next_line:
cleaned += line + "\n"
check_next_line = False
continue
for check_line in important_lines:
if check_line in line:
cleaned += line.split(check_line)[1] + "\n"
# see if the next line needs to be checked
for check_line_proceeding in important_proceeding_lines:
if check_line_proceeding in line:
check_next_line = True
break
print(cleaned)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment