-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass.py
44 lines (33 loc) · 989 Bytes
/
class.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
Python basic Object Oriented Program
"""
class Person:
"""
A class to represent a person.
Attributes:
name (str): The name of the person.
email (str): The email address of the person.
age (int): The age of the person.
"""
def __init__(self, name: str, email: str, age: int):
"""
Constructor for the Person class.
Parameters:
name (str): The name of the person.
email (str): The email address of the person.
age (int): The age of the person.
"""
self.name = name
self.email = email
self.age = age
def greet(self) -> None:
"""
Greet the user by their name
"""
print(f"Hi, {self.name.capitalize()}!")
if __name__ == "__main__":
NAME = input("Enter your name: ")
EMAIL = input("Enter your email: ")
AGE: int = int(input("Enter your age: "))
user = Person(NAME, EMAIL, AGE)
user.greet()