I'm wondering how to assign a a few different files to different corresponding numbers in python
<p>I'm wondering how a assign the file to just one of the numbers in the list, and if they make another file it will assign it to the next corresponding number.</p>

<pre><code>number = [1, 2, 3, 4, 5]

while True:
    with open(number, "w") as w:
        number.write(input(""))
    user_answer = input("1 to start another file, 2 to save and exit. -")
    if user_answer == ("1"):
        True
    elif user_answer == ("2"):
        break
</code></pre>

<pre><code># An integer denoting the name of the file to be generated.
# The name of the first file generated would be "1" (excluding the extension format)
i = 0
while True:
    # Create the path of the file to be generated
    file_path = str(i) + ".txt"
    with open(file_path, "w") as my_file_handle:
        print("Writing in file - '" + file_path + "'")
        my_file_handle.write(input(""))
    user_answer = input("1 to start another file, 2 to save and exit. - ")
    if user_answer == ("1"):
        # Increment the filename.
        i += 1
    elif user_answer == ("2"):
        break
</code></pre>

python python-3.x