Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

My current classes and test grades are Science test grades: 97 56 73 90 79 Avera

ID: 3662632 • Letter: M

Question

My current classes and test grades are

Science test grades:

97

56

73

90

79

Average: 79.00 %

How can I print this on one line ?

Math test grades: 89 100 85 94                   Average: 92.00 %

My code is:

print("My current classes and test grades are")

#pick a course and its scores, find its average, and print them all

       for (course, scores) in grades.items():

              counter = 0 #to find no of scores

              accumulator = 0 #to find total score

              print(course, "test grades:",)

              for s in scores:

                     print(s,)

                     counter = counter + 1

                     accumulator = accumulator + s

              print("Average:",format(accumulator/counter, '.2f'), "%")

Explanation / Answer

I think you are using pythone 3 thats why print(s,) didn't do the job.

In python 3 try using print(s,end=" ")

so

print("My current classes and test grades are")

#pick a course and its scores, find its average, and print them all

       for (course, scores) in grades.items():

              counter = 0 #to find no of scores

              accumulator = 0 #to find total score

              print(course, "test grades:",)

              for s in scores:

                     print(s,end=" ")

                     counter = counter + 1

                     accumulator = accumulator + s

              print("Average:",format(accumulator/counter, '.2f'), "%")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote