class Attendance: pass class Employee: pass def create(name, data): em = Employee() em.name, em.attendance = name, [] for date, attended in data: att = Attendance() att.date, att.present = date, attended em.attendance.append(att) return em def check(employee): total = 0 for att in employee.attendance: if att.present: total += int(att.date.split("-")[-1]) return total data = ("2025-01-04", True), ("2025-01-05", True), ("2025-01-06", False) employee = create("Mar", data) res = check(employee)
At the end of execution of the above script, what is value of?
res: | ||
employee.attendance[0].date: |
class Student: pass class University: pass def register(uni, data): for grade, names in data.items(): if not names: continue for name in names: st = Student() st.name, st.grade = name, grade uni.students.append(st) def get_student(university, grade): for st in university.students: if st.grade == grade: return st data = {8: ['Ariana', 'Dafina'], 9: ['Besnik'], 7: []} university = University() university.name, university.students = "Ise Boletini", [] register(university, data) first = get_student(university, 9) second = get_student(university, 5)
At the end of execution of the above script, what is value of?
first.name: | ||
second: |
Complete execution flow of the following program
Misses: 0
class Money: def set_info(self, currency, amount): self.currency = currency self.amount = amount def add(self, other): new_money = Money() new_money.set_info(self.currency, self.amount + other.amount) return new_money def subtract(self, other): new_money = Money() new_money.set_info(self.currency, self.amount - other.amount) return new_money def multiply(self, factor): new_money = Money() new_money.set_info(self.currency, self.amount * factor) return new_money def divide(self, divisor): new_money = Money() new_money.set_info(self.currency, self.amount / divisor) return new_money wallet1 = Money() wallet1.set_info("USD", 150) wallet2 = Money() wallet2.set_info("USD", 70) total = wallet1.add(wallet2) remaining = wallet1.subtract(wallet2) total.amount, remaining.amount
Complete execution flow of the following program
Misses: 0
class Money: def set_info(self, currency, amount): self.currency = currency self.amount = amount def add(self, other): new_money = Money() new_money.set_info(self.currency, self.amount + other.amount) return new_money def subtract(self, other): new_money = Money() new_money.set_info(self.currency, self.amount - other.amount) return new_money def multiply(self, factor): new_money = Money() new_money.set_info(self.currency, self.amount * factor) return new_money def divide(self, divisor): new_money = Money() new_money.set_info(self.currency, self.amount / divisor) return new_money wallet1 = Money() wallet1.set_info("EUR", 200) wallet2 = Money() wallet2.set_info("EUR", 100) total = wallet1.add(wallet2) remaining = total.multiply(2) total.amount, remaining.amount