Question: Keep getting type error: Can only concatenate str ( not int ) to str . Heres the code: def toFixed ( value , digits )
Keep getting type error: Can only concatenate str not "int" to str
Heres the code:
def toFixedvalue digits:
return fdigits value
printEnter the amount of students:"
amountOfStudents intinput
studentsList amountOfStudents
gradesList amountOfStudents
total
highest
saveHighestIndex
lowest
saveLowestIndex
for i in range amountOfStudents :
printEnter a last name for student" i :
lastName input
studentsListi lastName
printEnter a grade for student" i :
grade intinput
gradesListi grade
for i in range amountOfStudents :
if gradesListi highest:
highest gradesListi
saveHighestIndex i
if gradesListi lowest:
lowest gradesListi
saveLowestIndex i
total total gradesListi
printThe students and grades entered are:"
for i in range amountOfStudents :
printstudentsListi gradesListi
printAverage: toFixedtotal amountOfStudents,
printHighest: gradesListsaveHighestIndex studentsListsaveHighestIndex
printLowest: gradesListsaveLowestIndex studentsListsaveLowestIndex
Additionally would like my code to look like:
Enter the amount of students:
Enter a last name and grade: Davis
Enter a last name and grade: Jones
Enter a last name and grade: Larson
Enter a last name and grade: Moris
Enter a last name and grade:Smith
The students and grades entered are
Davis
Jones
Larson
Morris
Smith
Average:
Highest: Larson
Lowest: Morris
Rather than it asking me the name, input. Then the grade.
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
