Why my answer is defferent with the solution but still get pass

First time post the topic, if there any mistake please forgive me,

when i was doing the strings last chapter, i found that my coding is different with the solution but look like is still pass and get the instructions target, but not sure which one will be better!!

this is my code:

def username_generator(first_name, last_name):
  if len(first_name) >= 3 or len(last_name) >= 4:
    username = first_name[:3] + last_name[:4]
  if len(first_name) < 3 or len(last_name) < 4:
    username = first_name + last_name
  return username

first_name = "amao"
last_name = "choue"
test = username_generator(first_name, last_name)
print(test)

def password_generator(user_name):
  password = user_name[-1] + user_name[:-1]
  return password

user_name = "amaochou"
test1 = password_generator(user_name)
print(test1)

Also my first language isnt English, not sure could totally understand my questiuon.

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Do you have a link to the lesson? (so people can see the question in the lesson).

yes here is the link:
https://www.codecademy.com/paths/bi-data-analyst/tracks/dsf-python-fundamentals-for-data-science-part-ii/modules/dsf-python-strings/lessons/introduction-to-strings/exercises/review-i

Here is where ‘qualitative objectivity’ mirrors with ‘subjectivity’. For the most part, it is too early to say, ‘which is better’. And, it is pointless to wonder, in all honesty. It is hard enough learning the new concepts and constructs and their syntax and implementation. We only muddy the waters if at this juncture we are already asking about what is better.

Leave this question until it no longer becomes a question, but a decision on the writer’s part. You’ll know, soon enough how to improve upon your work. For now, take the pass and accept that your work is sufficient to earn it. Don’t get bogged down when there is so much work to do, out in front of you. It doesn’t matter, right now.

3 Likes