Hi i have worked upon different solution which does not use pop() function.
Below is the code :
all_students = [“Alex”, “Briana”, “Cheri”, “Daniele”, “Dora”, “Minerva”, “Alexa”, “Obie”, “Arius”, “Loki”]
students_in_poetry =
def add_student(index):
students_in_poetry.append(all_students[index])
return (students_in_poetry)
index=-1
while index>(-7):
add_student(index)
if index == (-6):
print(students_in_poetry)
index+= (-1)
print(students_in_poetry)
The above solution is not using any pop(). I tried to use python that i have learned so far.
Kindly help whether finding the solution in this way is correct or not or using pop() has any added advantage.
Moreover , i can add starting name also : for ex - starting from Alex.
Kindly give any suggestions to improve this code also.