Expected Output: Enter number of records: 2 Enter Student ID: 1234567890 Enter Name: Jane Doe Enter address: New York City Enter Age: 23 Enter Physics marks in 1st semester: 90 Enter C marks in 1st semester: 98 Enter Math marks in 1st semester: 89 Enter Student ID: 0987654322 Enter Name: John Doe Enter address: Alexander City Enter Age: 24 Enter Physics marks in 1st semester: 89 Enter C marks in 1st semester: 90 Enter Math marks in 1st semester: 97 C Grade Physics Grade 90 Average Grade 92.33 Student ID Name Address Age 23 Math Grade 1234567890 Jane Doe New York City Alexander City 98 89 0987654322 John Doe 24 89 90 97 92.00

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Hello! I am using python to program this. How do I fix the proper alignment for the output? so that no matter what I enter, it is equally aligned

the expected output is shown below

Here is my current code

-------------------------------------------------------

def SPACES_COUNTER (name):
    name
    
    counter_len = 0
    name_len = []

    while (counter_len < len(name)):
        for i in range (counter_len):
            name_len.append(len(name[i]))
        counter_len += 1
   
    return min(name_len, default=0)


stud_id = []
name = []
address = []
age = []
physicsMarks = []
cMarks = []
mathMarks = []
averageMarks = []

num_of_records = int(input("Enter number of records: "))
counter=0
while (counter< num_of_records):
    for i in range(num_of_records):
        stud_id_input = input("Enter Student ID: ")
        stud_id.append(stud_id_input)
        name_input = input('Enter Name: ')
        name.append(name_input)
        address_input = input('Enter address: ')
        address.append(address_input)
        age_input = int(input("Enter Age: "))
        age.append(age_input)
        physics_marks = int(input("Enter Physics marks in 1st semester: "))
        physicsMarks.append(physics_marks)
        c_marks = int(input("Enter C marks in 1st semester: "))
        cMarks.append(c_marks)
        math_marks = int(input("Enter Math marks in 1st semester: "))
        mathMarks.append(math_marks)
        average_marks = float((physics_marks + c_marks + math_marks)/3)
        averageMarks.append(average_marks)
        counter += 1
        
name_spaces = SPACES_COUNTER(name)
student_spaces = SPACES_COUNTER(stud_id)
address_spaces = SPACES_COUNTER(address)

counter_disp = 0
while (counter_disp < num_of_records):
    print("Student ID "+'  '* (student_spaces-8) +"Name"+' ' * (name_spaces-1) + "Address" +' ' * (address_spaces - 7)+'  '+ "Age"+'  '+ "Physics Grade"+'  '+ "C Grade"+'  '+ "Math Grade"+'  '+ "Average Grade")
    for i in range (num_of_records):
        
        print(stud_id[i],'  ' *(student_spaces - len(stud_id[i])+1),'', name[i],''*(name_spaces-len(name[i])+1), '', address[i],' '*(address_spaces - len(address[i])),'     ', age[i],' ', physicsMarks[i],' \t\t', cMarks[i],' \t', mathMarks[i],'  \t',  "{:.2f}".format(averageMarks[i]))
        counter_disp += 1 

Expected Output:
Enter number of records: 2
Enter Student ID: 1234567890
Enter Name: Jane Doe
Enter address: New York City
Enter Age: 23
Enter Physics marks in 1st semester: 90
Enter C marks in 1st semester: 98
Enter Math marks in 1st semester: 89
Enter Student ID: 0987654322
Enter Name: John Doe
Enter address: Alexander City
Enter Age: 24
Enter Physics marks in 1st semester: 89
Enter C marks in 1st semester: 90
Enter Math marks in 1st semester: 97
Student ID
Name
Address
Age
Physics Grade
C Grade
Math Grade
Average Grade
1234567890
Jane Doe
New York City
23
90
98
89
92.33
0987654322
John Doe
Alexander City
24
89
90
97
92.00
Transcribed Image Text:Expected Output: Enter number of records: 2 Enter Student ID: 1234567890 Enter Name: Jane Doe Enter address: New York City Enter Age: 23 Enter Physics marks in 1st semester: 90 Enter C marks in 1st semester: 98 Enter Math marks in 1st semester: 89 Enter Student ID: 0987654322 Enter Name: John Doe Enter address: Alexander City Enter Age: 24 Enter Physics marks in 1st semester: 89 Enter C marks in 1st semester: 90 Enter Math marks in 1st semester: 97 Student ID Name Address Age Physics Grade C Grade Math Grade Average Grade 1234567890 Jane Doe New York City 23 90 98 89 92.33 0987654322 John Doe Alexander City 24 89 90 97 92.00
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY