I've written the following code:
class User:
def __init__(self, first_name, last_name, gender, location):
self.first_name = first_name
self.last_name = last_name
self.gender = gender
self.location = location
def describe_user(self):
print(f"User {self.first_name} {self.last_name} is a "
f"{self.gender} from {self.location}")
def greet_user(self):
print(f"Hello there {self.first_name}, you come from the "
f"{self.last_name} family. You currently reside in "
f"{self.location}. Oh, I forgot to mention that you're "
f"a {self.gender}. Have a nice day!")
This works, but I don't think it looks very clean.
The way I initially tried to accomplish this, which seemed most natural to me was like this:
def describe_user(self):
print(f"User {self.first_name} {self.last_name} is a
{self.gender} from {self.location}")
But unfortunately that didn't work. Is there a better way to do this?