Python Forum
Making a Class Person ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Making a Class Person ? (/thread-39852.html)



Making a Class Person ? - Kessie1971 - Apr-23-2023

How do I create a Person class is a generic class, which only stores some basic attributes. These attributes are: name, sex and date of birth (as a datetime object). The attributes must be invisible outside the object.
Write a constructor for this class that takes three arguments (name, sex ('M' or 'F') and date of birth (as a date string)).


RE: Making a Class Person ? - deanhystad - Apr-23-2023

Read one of the thousands of web pages that talk about classes in Python, or in any other language for that matter. Though the implementation details differ slightly from language to language, the basic concepts are the same. Then you try to solve the problem yourself, and if you need help you come back here, show what you have tried, and ask for help. I don't expect that you will need it. This is not a difficult assignment.


RE: Making a Class Person ? - Kessie1971 - Apr-23-2023

Thanks for your answer but for my beginner is this difficult. I now how I must make a class but these is difficult for my, please help my

Write a constructor for this class that takes three arguments (name, sex ('M' or 'F') and date of birth (as a date string)).


RE: Making a Class Person ? - deanhystad - Apr-23-2023

What have you tried so far? This is not a site where people do your homework. In your three posts the forum all you've done so far as post the instructions for your homework assignments. Zero effort = zero return.