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>How about this?</p>

<pre><code>elif(useMenu == "3"):

    oldName = input("What student would you like to edit? ")

    if oldName in Students:

        index = Students.index(oldName)
        newName = input("What is the student's new name? ")
        Students[index] = newName
        time.sleep(1)
        print(str(oldName) + " has been edited to " + str(newName))
        time.sleep(1)

    else: 

       print('Student' + oldName + 'not found!')

    print(Students)
</code></pre>

<p>with output:</p>

<pre><code>1. Add Student
2. Delete Student
3. Edit Student
4. Show All Students
What shall you do? '3'
What student would you like to edit? 'Mary'
What is the student's new name? 'Marry'
Mary has been edited to Marry
['Marry', 'Matthew', 'Mark', 'LianneSpencerJohn', 'Logan', 'Sam', 'Judy', 'Jc', 'Aj']
</code></pre>

python list