NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

class Course:
def __init__(self, name, units, is_short_course=False):
self.name = name
self.units = units
self.is_short_course = is_short_course

def result_summary(self):
summary = f"Course: {self.name}n"
summary += f"Number of Units: {len(self.units)}n"

if self.is_short_course:
summary += "Is self funded: Truen"

summary += "IDtUnit NametAverage Markt# of Studentsn"
for unit in self.units:
summary += f"{unit['ID']}t{unit['Unit Name']}t{unit['Average Mark']}t{unit['#of Students']}n"
summary += "ENDn"
return summary

# Example usage:
units = [
{"ID": 1, "Unit Name": "Adv. OOP", "Average Mark": 78.41, "#of Students": 30},
{"ID": 2, "Unit Name": "Adv. Proj", "Average Mark": 70.00, "#of Students": 17},
{"ID": 3, "Unit Name": "Thesis", "Average Mark": 68.47, "#of Students": 21},
{"ID": 4, "Unit Name": "Networks", "Average Mark": 81.35, "#of Students": 19}
]

regular_course = Course("NMIT", units)
short_course = Course("NMIT", units, is_short_course=True)

print(regular_course.result_summary())
print(short_course.result_summary())


The relationship between these two methods lies in the conditional logic used to determine whether the course is a short course or not. If the is_short_course attribute is True, the method includes additional information (in this case, "Is self funded: True") in the summary. Otherwise, it only displays the basic information about the course and its units. Both methods generate a summary of the course's units, including the ID, unit name, average mark, and number of students.
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.