Python Forum
Making a Class Person ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a Class Person ?
#1
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)).
Reply
#2
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.
Reply
#3
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)).
Reply
#4
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  print(f"{person}:") SyntaxError: invalid syntax when running it AryaIC 11 16,091 Nov-07-2020, 10:17 AM
Last Post: snippsat
  How can create class Person :( Azilkhan 1 1,923 Nov-21-2019, 08:12 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020