Is there something wrong with my indentation?

so in the 2nd exercise (graduation_reqs function) the default solution is this:
def graduation_reqs(credits):
if credits >= 120:
return “You have enough credits to graduate!”

print(graduation_reqs(120))

So instead of using the print command in order to get the result i wanted to make it more straight by using only the functions name and the input number in it. So i did this and i got error. Can u please explain me why i get error from this?:

def graduation_reqs(credits):
if credits >= 120:
print(“You have enough credits to graduate!”)

graduation_reqs(120)

This is what we would do if our function is expected to return a response.

1 Like

I dont get it. By creating a function we tell the program that when we type its name everytime its gonna repeat some certain steps in order. So when i type:

def graduation_reqs(credits):
if credits >= 120:
print(“You have enough credits to graduate!”)

graduation_reqs(120)

By evaluating that credits >= 120 as true it should move to the next step which is the print command right?

Indentation is critical in Python. We cannot see yours.

yeah i didnt put ident on the print statement below the if. LoL. code logic was valid though.

1 Like