From 834dfbc46b764687fae476fc5ec8eea5909760ae Mon Sep 17 00:00:00 2001 From: 99omniaashraf Date: Fri, 15 Mar 2024 14:19:34 -0700 Subject: [PATCH] Step 2: User model --- 0x01-challenge/user.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 0x01-challenge/user.py diff --git a/0x01-challenge/user.py b/0x01-challenge/user.py new file mode 100644 index 0000000..8a32eba --- /dev/null +++ b/0x01-challenge/user.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +""" +User class +""" + +class User(): + """ Documentation """ + + def __init__(self): + """ Documentation """ + self.__email = None + + @property + def email(self): + """ Documentation """ + return self.__email + + @email.setter + def email(self, value): + """ Documentation """ + if type(value) is not str: + raise TypeError("email must be a string") + self.__email = value + + + +if __name__ == "__main__": + + u = User() + u.email = "john@snow.com" + print(u.email)