Untitled

 avatar
unknown
plain_text
2 years ago
451 B
3
Indexable
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()