Esempio n. 1
0
def main():

    student1 = Student('Anty', 20)
    student1.accept_task(1)
    student1.accept_task(2)
    student1.accept_task(3)
    student2 = Student('Mary', 14)

    student1.age += 1
    student2.name = 'Alice'
    student2.accept_test(12)
    student1.accept_test(7)
    student1.print_info()
    student2.print_info()

    pprint(student1.__dict__)

    professor1 = Professor('Dr.Who', 30)
    professor1.print_info()
Esempio n. 2
0
def main():
    student1 = Student('Ivan', 18)
    print(type(student1), id(student1))

    student2 = Student('Mariya', 18)
    print(type(student2), id(student2))

    #student1.name = 'Ivan Ivanov'
    #student1.age = 18
    print(student1.name, student1.age)
    student1.age += 1
    print(student1.name, student1.age)

    print(student2.name, student2.age)
    student2.name = 'Alice'
    print(student2.name, student2.age)

    student1.accept_task(1)
    student1.accept_task(3)
    student1.accept_task(5)
    student1.print_info()
    student2.accept_test(12)
    student2.print_info()

    # print(type(Student))
    #
    # pp(student1.__dict__)
    # student1.__dict__['name'] = 'IVAN'
    # print(student1.name)
    #
    # pp(Student.__dict__)

    prof1 = Professor('Dr. Who', 42)
    prof1.salary = 1000
    prof1.print_info()
    print(prof1)
    print(prof1.salary)
from student import Student
from proffesor import Proffesor

if __name__ == '__main__':

    st1 = Student("Bill", 22)
    st2 = Student("Alice", 24)

    print(st2.name, st2.age)
    print(id(st2))

    st1.print_info()
    st2.print_info()

    st1.accept_task(2)
    st1.accept_test(10)
    st1.print_info()

    st2.accept_multy_tasks(1, 2, 3, 4, 5, 6)
    st2.print_info()

    prof = Proffesor("Pete", 77)
    prof.print_info()

    # prof.set_salary(100)
    prof.salary = 100
    # prof.groups = ['Math', "Phis", "CS"]
    prof.add_group("DB")
    prof.add_group("CS")
    prof.print_info()
    prof.remove_groups("DB")
Esempio n. 4
0
# print(math.pi)
# d = collections.OrderedDict()
# pprint.pprint(sys.path)

from student import Student
from professor import Professor

if __name__ == '__main__':

    student1 = Student('Bill', 22)
    student2 = Student('Alice')
    student3 = Student('Scott', 18)

    student1.accept_task(3, 5, 7, 11, 13, 17, 19)
    student2.accept_task(1, 2, 3, 4, 5, 6)
    student2.accept_test(11, 12)
    student3.accept_task(1, 2, 3)
    student3.accept_test(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)

    # student1.print_info()
    # student1.print_info()
    # student2.print_info()
    # student3.print_info()

    # print(id(Student))
    # print(type(type(type(Student))))

    # pprint.pprint(Student.__dict__)
    # pprint.pprint(student1.__dict__)

    # student1.__dict__["name"] =  " William"
#         print('================================')
#
#     def accept_task(self, *number_of_tasks):
#         for task_number in number_of_tasks:
#             self.hw_results[task_number-1] = 1
#
#     def accept_test(self, *number_of_tests):
#         for test_number in number_of_tests:
#             self.test_results[test_number-1] = 1
#
#     def total_rank(self):
#         total_rank = sum(self.hw_results)
#         for i in range(Student.NUMBER_OF_TESTS):
#             total_rank += self.test_results[i] * Student.TEST_WEIGHTS[i]
#         return total_rank

if __name__ == "__main__" :
student1 = Student('Bill', 22)
student2 = Student('Alice')
student3 = Student('Scott', 18)

student1.accept_task(3,5,7,11,13,17,19)
student2.accept_task(1,2,3,4,5,6)
student2.accept_test(1,2,3,4,5,6,12)
student3.accept_task(1,2,3,12)

student1.print_info()
student2.print_info()
student3.print_info()
#
# monkey patching