You basically look like doing nothing only outputting simple range to file. What is purpose of those import statements in begining, I see no reference to any module.
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
Your description sounded like you want to do something like:
import random
input = raw_input
if __name__ == "__main__":
rows = int(input("Input the number of rows: "))
columns = int(input("Input the number of columns: "))
with open("user.txt",'w') as out:
start, end = int(input("Specify the start of the range: ")), int(input("Specify the stop of the range: "))
step = int(float(end-start)/rows/columns)+1
width = len(str(end))
my_range = range(start, end+1, step)
random.shuffle(my_range)
for count, value in enumerate(my_range):
print '%*s' % (width, value),
print >>out, '%*s' % (width, value),
if columns - 1 == count % columns:
print
print >>out
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
BUG: +1, at line 10 should go after -start.
step = int(float(end-start+1)/rows/columns)
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852