0
File handling . This code is returning blank lines. Tryingto make a program to make you sleep. Is incomplete btw
x = input() f = open("dhruv.txt", "w+") def wrt(x, n): if x == "": s = str(n) + " Sheep \n" f.write(s) n += 1 print(f.readline()) y = input() wrt(y, n) else: print("Sweet Dreams!!!") wrt(x, 0)
4 odpowiedzi
0
I am making a program which when is run. Accepts input. Each time the enter key is pressed i want to print the counting of sheeps.and when anything else than the enter key is pressed then the program assumes that the person is asleep. Basically it would be a program to make someone feel sleepy.
0
I actually am a newbie so dont know much about file handling
0
But why do you want to use files in this program .you can do without files.🤔🤔
0
I want to use files please.i know it is easier without it.