Person Class

You are asked to create a Person class that has four attributes: name, age, gender, and address. The class should also have a method display_info() which when called, prints the person's details in a readable format.
The class should accept 4 arguments:
  1. The person's name.
  1. The person's age.
  1. The person's gender (M for male, F for female).
  1. The person's address.
The output of the display_info() method should print the information in the following format: Name: {name}, Age: {age}, Gender: {gender}, Address: {address}
Input
Output
p = Person('Anna', 34, 'F', '123 Fake St.'); p.display_info()
Name: Anna, Age: 34, Gender: F, Address: 123 Fake St.
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue