Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I got Table 1 & 2 done, but once i add in table 3 it prints multiple times and I ' m not sure why?
I got Table & done, but once i add in table it prints multiple times and Im not sure why?
For Table truncate the titles to the number of characters shown, but watch out for short titles. Make sure the enrollments all line up as shown. Add up all the enrollments and print the total.
For Table sort the list this is one statement in Python and print the complete title, but make sure all the enrollments line up as shown. For Table make sure your program actually prints the table based on the length of the longest title. You will have to write code to find the length of the longest title, then use that number.
#table
def tablecourses:
printTable
total
for course in courses:
data course.split
deptcode datastrip
coursenum datastrip
enrollement datalendatastrip
length lendata
printdata data
total intdatalength
print
total: total
#table
def tablecourses:
printTable
for course in courses:
deptcode course:
courseinfo course:
printfdeptcodecourseinfo
#table
def tablecourses:
printTable
item
k
for course in courses:
data course.split
nm joindata:lendatastrip
itemk lennm
k
sortedx sorteditemitems key lambda kv: kv reverse True
for i in sortedx:
printcoursesi
def main:
courses
courses CS Introduction to Python Programming
CS Operating Systems Adminstration
CS Computer Networking
CS Discrete Mathmatics
CS Computer Architecture
MA Calculus and Analytical Geometry for Majors I
MA Linear Algebra
MA Precalculus Mathmatics
CS Introduction to Cybersecurity
IS Data Management Systems
MG Advanced Business Statistics
courses.appendIT Information Technology
for aCourse in courses:
printaCourse
tablecourses
tablecourses
tablecourses
#calling main function
main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started