Hi! To find out what I can do, say @discobot display help
.
Dude this excercise was unbelievable, i wrote the code perfectly as asked, when i run the code it’s says it’s not correct. After i press the “show solution” button, it shows me the exact same code. Ok fine, number 3 i have to write the print statement even that it showed as wrong while in the solution it was exactly the same code, dude wtf?
I see this issue has already been mentioned before. Still not fixed.
Hey @textjumper17671, welcome to the forums!
Can we see your original code? You never know, maybe something was spelled wrong or you had some extra white space.
Hi stevencopeland, thank you!
Sure thing, absolutely no problem.
So i just redid the excercise this is are the first 2 steps i wrote:
def greater_than(x, y):
if x > y:
return x
if y > x:
return y
if x == y:
return “These numbers are the same”
def graduation_reqs(credits):
if credits >= 120:
return “You have enough credits to graduate!”
The first step seemed to go fine, the second step gives me the error ''did you remember to define graduation_reqs"?
The third went flawless.
Update: I think it’s because of the spaces before the code? That seems to be the only logical issue to me.
Do you think you could format your code so we could see all the whitespace? Try putting three backticks(`) before and after your code?
Check out this post if you need help:
Hello,
it would be nice if someone could tell me what I’m doing wrong here. As far as I understand the task correctly I should only create the function.I want to test it (“run”). If I am asked to test it with an unrealistic return. Is it my mistake or that of the script?
I hope you see the picture if not it is the task 6. Relational Operators II and there the first.
p.s. sorry for the bad English
The code above only returns the equality case, and not the value that is greater than the other. Add that code to your function after the if
statement.
Oh yes this is what it says. Sorry, I didn’t catch that. That was unnecessary.
In Python, why do no we not have to deal with both the true and false scenarios for the functions that we write?
I may be misudnerstanding you but these lessons are just an introduction to the basics of controlloing flow in Python. It’s to teach the syntax and general stucture of conditionals, they’re not meant to be applicable to every possible scenario. More generally you’d wind up with a lot of unnecessary else: pass
statements if you had to deal with the False output too.
Working through the Relational Operators II (page 6) instructions:
The first step doesn’t provide values for x and y so I’ve written it as is, and I’ve been consistently getting an error that it is expecting 2 actual values defined for x and y. How am I supposed to know what to use if the instructions don’t say?
These numbers are the same
versus
These numbers are equal
Be sure to use text and variables as specified in the instructions.
I knew that! Thanks for the quick response
Yes dude!!! I’m also getting this same error…message
Hi! To find out what I can do, say @discobot display help
.
In order to graduate, a student must have at least 120 credits.
What would happen if we called graduation_reqs(120)
?
Side note: discobot cannot resolve this type of inquiry.
No kidding. What purpose would any of us serve if that were the case? Luckily we’re only helping new STEM pursuers to reach that level of ML and AI, or at least some degree of solution analysis by the bot. The SCT would be relegated, mind.
Can I get some feedback on my control flow function, I want to know if there is anyway to rewrite this in 2 if statements instead of 3.
def greater_than(x, y):
if x == y:
return "These numbers are the same"
elif x > y:
return x
elif y > x:
return y