A rooky needs help to understand If

Hello everyone and thank you for stopping by to help me!

  if user_name == "Dave":
    return "Get off my computer Dave!"

user_name =  "Malgosh"

# This is the original content. The exercise wants me to make a new If-Statement.
This is what I have written as a response but I get an error constantly and I don't know why.

def dave_check_2(user_name):
  if user_name == "angela_catlady_87":
    return "I know it is you Dave! Go away!"

# I would love to know what I am doing wrong and why.
Thank you for your help everyone. I really appreciate it.

From what I can tell, your code looks fine. You’ve formatted your whole message as code. If you could re-post your code with just the actual code between the back tics:

Code goes here.

Then we might be able to see what is wrong. What type of error are you getting? If the word None is being printed to the console, that’s not an error. That is the default return value since the user_name is not "angela_catlady_87"


Most important: What is the error message?

Are you calling your function using an actual user name?

user_name = "angela_catlady_87"
user_name = "ruby"


I know it is you Dave! Go away!

Thank you very much for the advice. I tryed to make it the way you say, however something went wrong and all got formated.

But I was able to find the solution at the end :slight_smile:

1 Like

Thanks for the help. Thanks to your example I was able to find the solution :slight_smile: really owe you one, mate.

1 Like

Hello, whatsup? i am fine

Whats the code? i need help …

Hello, @board5220432265, and welcome to the forums.

Do you have a specific question?

no but i don’t understand this: 1. Write a function called greater_than that takes two integer inputs, x and y and
returns the value that is greater. If x and y are equal, return the string
“These numbers are the same”
2. The nearby college, Calvin Coolidge’s Cool College (or 4C, as the locals call it)
requires students to earn 120 credits to graduate. Write a function called
graduation_reqs that takes an input credits and checks if the student has
enough credits to graduate. If they do, return the string
“You have enough credits to graduate!”

Have you tried writing any code yet? If so, you could share it, and someone can help sort it out. If not, consider the following example:

Example using if:
#this function will determine if two values are the same
def same(x, y):
  #if they are the same, return "They're the same!"
  if x == y:
    return "They're the same!"
  #if they're not the same return "They're different!"
  return "They're different!"

#try it:
print(same(1, 2))
print(same(2, 2))


They’re different!
They’re the same!

1 Like

Never mind i know that code