Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
451 B
3
Indexable
Never
start = int(input('Start: '))
stop = int(input('Stop: '))

with open('table.txt', 'w') as table_file:
    for i in range(start, stop):
        binary_representation = f'{i:08b}'
        table_file.write(f'{binary_representation} is {i}\n')

# Read and display the contents of the file.
table_file_readonly = open('table.txt', 'r')
print(table_file_readonly.read(), end='')
#Close the file so the data is saved
table_file_readonly.close()