Problem with writing an objective oriented python assignment

Can someone help me while writing an assignment?

It is necessary to create a template for creating objects of the Student type. Each Student should have the following properties: It is necessary to create a template for creating objects of type Student. Every student should have the following characteristics: name, address, phone, course, index_number.

Each object that represents a student should have the following behavior (method): getInfo()

It is necessary that the getInfo() method prints data about one student (for example Name: John Benson, address: High Park 36, Phone: (507) 833-3567, Course: Geography, Index number: 123/007).

To implement templates for creating objects, use the class.

Finally, on the basis of the created template, it is necessary to create three objects representing three students with data as desired. Above the three created objects, it is necessary to call the method for printing data – getInfo() and display the information with the print command.

I hope that someone can help me with writing this assignment, since I tried but honestly it didn’t work.

I would need an assignment written in python.

Thanks in advance for all the effort and help.

>Solution :

class Student:

def __init__(self,name:str,address:str,phone:str,course:str,index_number:str) -> None: = name
    self.address = address = phone
    self.course = course
    self.index_number = index_number

def getInfo(self) -> None:

here i have taken both phone and index_number as strings but you can change it to type int and typecast to str before printing if you feel like

Leave a Reply