0
Trying to solve filling up with up numbers in intermediate python
Don't know what to do from here N = int(input()) file = open("numbers.txt", "w+") file.write("\nN") file.close() f = open("numbers.txt", "r") print(f.read()) f.close()
7 ответов
0
I assigned a variable to 1 and used a while loop to write the variable and a new line to the file and increment the variable by 1.
If you need I can show you my code but I think you got this
0
Sorry can you show me
0
N = int(input())
file = open("numbers.txt", "w+")
x = 1
while x <= N:
file.write(str(x) + "\n")
x += 1
file.close()
f = open("numbers.txt", "r")
print(f.read())
f.close()
No problem :)
0
Thanks
0
Can you help me with the book club practice
0
You are given a books.txt file, which includes book titles, each on a separate line.
Create a program to output how many words each title contains, in the following format:
Line 1: 3 words
Line 2: 5 words
...
Make sure to match the above mentioned format in the output.
Alexander Crum
0
Alexander Crum it worked thanks
Any idea on balanced parenthesis in python data structure