Edit list of entries using Python
<p>My script so far:</p>

<pre><code>#DogReg v1.0
import time
Students = ['Mary', 'Matthew', 'Mark', 'Lianne' 'Spencer'
            'John', 'Logan', 'Sam', 'Judy', 'Jc', 'Aj'  ]

print("1. Add Student")
print("2. Delete Student")
print("3. Edit Student")                             
print("4. Show All Students")
useMenu = input("What shall you do? ")
if(useMenu != "1" and useMenu != "2" and useMenu != "3" and useMenu != "4"):
    print("Invalid request please choose 1, 2, 3, or 4.")
elif(useMenu == "1"):
    newName = input("What is the students name? ")
    Students.append(newName)
    time.sleep(1)
    print(str(newName) + " added.")
    time.sleep(1)
    print(Students)
elif(useMenu == "2"):
    remStudent = input("What student would you like to remove? ")
    Students.remove(remStudent)
    time.sleep(1)
    print(str(remStudent) + " has been removed.")
    time.sleep(1)
    print(Students)
elif(useMenu == "3"):
</code></pre>

<p>So I'm trying to be able to let the user input a name they want to edit and change it. </p>

<p>I tried looking up the function for editing list entries and I haven't found one I'm looking for.</p>

<p>Suppose the user wants to change <code>'Mary'</code> to <code>'Maria'</code>:</p>

<pre><code>student_old = 'Mary'
student_new = 'Maria'
change_index = Students.index(student_old)
Students[change_index] = student_new
</code></pre>

<p>Note that you will have to add proper error handling - for example, if the user asks for modifying <code>'Xavier'</code> who is not in your list, you will get a <code>ValueError</code>.</p>

python list