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)
Could you explain what you're actually trying to do in a simple word
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.
I actually am a newbie so dont know much about file handling
But why do you want to use files in this program .you can do without files.🤔🤔
I want to use files please.i know it is easier without it.
Why won't my image display
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
How the answer is 50?
Number of Ones ( C++ ) question!