From 5c78f9ab76d6774e8ba600fa02f715200c7ea1e7 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Fri, 28 Feb 2025 01:17:57 +0000 Subject: [PATCH] Completed Exercise 9-3 Users --- Chapter_09/9-03_users.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Chapter_09/9-03_users.py diff --git a/Chapter_09/9-03_users.py b/Chapter_09/9-03_users.py new file mode 100644 index 0000000..647b727 --- /dev/null +++ b/Chapter_09/9-03_users.py @@ -0,0 +1,32 @@ +# Exercise 9-3 Users +# Learning Objective: Create a class with two predefined arguments then others,and two methods; make 3 instances of the class utilizing the methods created. + +class Users: + def __init__(self, first_name, last_name, dob, state, hair_color): + """Initialize User Profile variables""" + self.first_name = first_name + self.last_name = last_name + self.dob = dob + self.state = state + self.hair_color = hair_color + + def describe_user(self): + """Prints descriptions of user based on inputs""" + print(f"{self.first_name} {self.last_name} was born on {self.dob}, they live in {self.state} and they have {self.hair_color}") + + def greet_user(self): + """Prints personalized greeting to user specified""" + print(f"Welcome to this python program, {self.first_name} {self.last_name}!") + + +user_1 = Users("Tony", "Redilman", "03/16/56", "Montana", "Black") +user_2 = Users("Georgina", "Reynolds", "04/23/76", "Colorado", "Auburn") +user_3 = Users("Kenneth", "Librant", "05/05/88", "Arizona", "Blonde") + +user_1.describe_user() +user_2.describe_user() +user_3.describe_user() + +user_1.greet_user() +user_2.greet_user() +user_3.greet_user() \ No newline at end of file