Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1: [-1, 5, 3, 7, 2]
- # 2: 0 6 (pass by value, pass by reference)
- # 3:
- # def __init__(self, Cname):
- # self.__Cname = Cname
- # class CpeCourse(Course):
- # def __init__(self, Cname, *students)
- # Course.__init__(self, Cname)
- # self.__studentList = []
- # for student in students:
- # self.__studentList.append(student)
- # def insert_student(student):
- # self.__studentList.append(student)
- # for student in self.__studentList:
- # sum += student.getSmark()
- # return sum / len(self.__studentList)
- # print(Course.getCname(self))
- # for student in self.__studentList:
- # print(student.getSName(), " mark= ", student.getSmark())
- # print("Average: ", self.getAverage())
- # f = open(Course.getCName(self), "wb")
- # for student in self.__studentList:
- # pickle.dump(student, f)
- # f.close()
- # f = open(Course.getCName(self), "rb")
- # while True:
- # try:
- # studentList.append(pickle.load(f))
- # except EOFError:
- # break
- # f.close()
- # Course c1 = Course("CpE211", s1, s2)
- # 4: [7, 6, 2, 2, 8]
- # 5: 30
- # i = 1 => s = 0
- # i = 2 = + 2 (2)
- # i = 3 = +4 (6)
- # i = 4 = +6 (12)
- # i = 5 = +8 (20)
- # i = 6 = +10 (30)
- # 6:
- # wb = Workbook()
- # ws1 = wb["Names"]
- # ws2 = wb["marks"]
- # ws3 = wb.create_sheet("Students List")
- # ws1_colA = ws1['A2':'A'+str(n+1)]
- # ws2_colA = ws2['A2':'A'+str(n+1)]
- # ws3_colA = ws3['A2':'A'+str(n+1)]
- # ws3_colB = ws3['B2':'B'+str(n+1)]
- # ws3_colA[i][0].value = ws1_colA[i][0].value
- # ws3_colB[i][0].value = ws2_colA[i][0].value
- # ...
- # wb.save("exam.xlsx")
- # 7: for.... d[i].display()
- # 8: 61 6 (61 instead of 51 because it uses the m1() found in B... even in A
- # 10: [A-Za-z_]\w*
- # 11: 35 1 (times is pass by value, can't be changed over functions)
- # 12: re.findall("\^_?\^", line) ^ must be escaped, ? is a ternary operator
- # count += len(result) <-- treat result as a list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement