Advertisement
DefiledDev

20192020_2nd_Sem

Jan 14th, 2023
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. # 1: [-1, 5, 3, 7, 2]
  2. # 2: 0 6 (pass by value, pass by reference)
  3.  
  4. # 3:
  5. # def __init__(self, Cname):
  6. # self.__Cname = Cname
  7.  
  8. # class CpeCourse(Course):
  9. # def __init__(self, Cname, *students)
  10. # Course.__init__(self, Cname)
  11. # self.__studentList = []
  12. # for student in students:
  13. # self.__studentList.append(student)
  14.  
  15. # def insert_student(student):
  16. # self.__studentList.append(student)
  17.  
  18. # for student in self.__studentList:
  19. # sum += student.getSmark()
  20. # return sum / len(self.__studentList)
  21.  
  22. # print(Course.getCname(self))
  23. # for student in self.__studentList:
  24. # print(student.getSName(), " mark= ", student.getSmark())
  25. # print("Average: ", self.getAverage())
  26.  
  27. # f = open(Course.getCName(self), "wb")
  28. # for student in self.__studentList:
  29. # pickle.dump(student, f)
  30. # f.close()
  31.  
  32. # f = open(Course.getCName(self), "rb")
  33. # while True:
  34. # try:
  35. # studentList.append(pickle.load(f))
  36. # except EOFError:
  37. # break
  38. # f.close()
  39.  
  40. # Course c1 = Course("CpE211", s1, s2)
  41.  
  42. # 4: [7, 6, 2, 2, 8]
  43.  
  44. # 5: 30
  45. # i = 1 => s = 0
  46. # i = 2 = + 2 (2)
  47. # i = 3 = +4 (6)
  48. # i = 4 = +6 (12)
  49. # i = 5 = +8 (20)
  50. # i = 6 = +10 (30)
  51.  
  52. # 6:
  53. # wb = Workbook()
  54. # ws1 = wb["Names"]
  55. # ws2 = wb["marks"]
  56. # ws3 = wb.create_sheet("Students List")
  57. # ws1_colA = ws1['A2':'A'+str(n+1)]
  58. # ws2_colA = ws2['A2':'A'+str(n+1)]
  59. # ws3_colA = ws3['A2':'A'+str(n+1)]
  60. # ws3_colB = ws3['B2':'B'+str(n+1)]
  61.  
  62. # ws3_colA[i][0].value = ws1_colA[i][0].value
  63. # ws3_colB[i][0].value = ws2_colA[i][0].value
  64.  
  65. # ...
  66.  
  67. # wb.save("exam.xlsx")
  68.  
  69. # 7: for.... d[i].display()
  70.  
  71. # 8: 61 6 (61 instead of 51 because it uses the m1() found in B... even in A
  72.  
  73. # 10: [A-Za-z_]\w*
  74.  
  75. # 11: 35 1 (times is pass by value, can't be changed over functions)
  76.  
  77. # 12: re.findall("\^_?\^", line) ^ must be escaped, ? is a ternary operator
  78. # count += len(result) <-- treat result as a list
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement