I'm doing an ascii problem in Python. The goal is to create an image using certain values to create certain images:
The value 0 creates a "-" and moves the cursor to the right for the next variable. 1 creates a "/" and moves the cursor up one row and to the right. 2 creates a "|" and moves the cursor up one row in the same position. 3 creates a "\" and moves the cursor up one row and over to the left one space. 4 creates a "-" and moves the cursor left. 5 creates a "/" and moves the cursor down one row and to the left. 6 creates a "|" and moves the cursor down one row. 7 creates a "\" and moves the cursor down one row and to the right.
However I'm not sure how to print this to make it happen. My code:
file_object = open("input.txt","w")
file_object.write("770000334444")
file_object.write("2255500004666")
file_object.write("002444")
file_object.close()
file_object = open("input.txt","r")
while True:
c = file_object.read(1)
if c == "0":
print("-")
if c == "1":
print("/")
if c == "2":
print("|")
if c == "3":
print("\")
if c == "4":
print("-")
if c == "5":
print("/")
if c == "6":
print("|")
if c == "7":
print("\")