Question: students = [ John Smith Abby Johnson Peter Smith Paisley White Fayth Holland Kolton MacDonald ] studentCount = 0 def addStudent ( ) : student
students
"John Smith"
"Abby Johnson"
"Peter Smith"
"Paisley White"
"Fayth Holland"
"Kolton MacDonald"
studentCount
def addStudent:
studentid inputEnter student ID:
name inputEnter student name:
age inputEnter student age:
gpa inputEnter student GPA:
newstudent
id: studentid
"name": name,
"age": age,
"gpa": gpa
students.appendnewstudent
studentCount
printStudent added successfully."
def displayStudents:
for student in students:
printfID: studentid Name: studentname Age: studentage GPA: studentgpa
I keep getting this error code for the last part
printfID: studentid Name: studentname Age: studentage GPA: studentgpa
TypeError: string indices must be integers, not str
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
