Im trying to do a line break for every single number I send to "stuff.txt"
here's my code...
import dice # dice is a module i used
d = 1
stuff = open("stuff.txt", "a")
while d <= 100:
print(d)
d = d + 1
stuff.write(str(dice.roll_dice(4) ))
print("sent a random number from 1-4 to stuff.txt")
stuff.close()
for the dice module
import random
def roll_dice(num):
return random.randint(1, num)
When I run the code, I get 100 dice rolls but all the numbers are all on the same line. What i'm trying to do is have those numbers on seperate lines using a line break. I want the numbers to turn into:
1
2
3
instead of 123