How am I supposed to check the value of answer?

The game isn’t rigged. Aw, shux is a lot more positive (60 till and including 90) then Work on your aim (lower then 60)

I don’t know man, maybe it’s because english isn’t my native language, but “aw shux” sounds a lot like “You accuracy sucks, man” whereas “Work on your aim” sounds a bit better, like “Not bad, but there’s still a lot of room for improvement”…

1 Like

work on your aim exclamation mark (huge different)

anyway, we could argue about spoken languages all day, in this code:

def accuracy_rating(targets_hit):
    if targets_hit > 90:
        return "Super accurate!"
    elif targets_hit < 60:
        return "Work on your aim!"
    else:
        return "Aw, shux."

the else message should be friendlier then the elif

then the logic of the program is fine

In my opinion this is a great example of symbols becoming vague.

1, -1 and 0 are being used as variables. If you said instead x, y and z – this would be the same thing.

“1” could mean anything – it could mean “turn right”, “-1” could mean “turn left” and “0” could be “Keep driving straight, change nothing.”

“1” could also mean “paint it red” and “-1” could be “paint it blue” and “0” could be “ask Bob for spare paint and paint the barn whatever color he gives you”.

thank you, that is very helpful info. :white_check_mark:

I could declare a variable inside the function greater_less_equal_5() and take its input from the user and pass no arguments to the method. Then I can perform if, elif operations comparing the variable with 5 and then call the method. That’s another way to doing it right?
My version of code gives me an indent error. Irrespective of that, logically, would this code work?

def greater_less_equal_5():
number_of_biscuits=raw_input
("Enter number of biscuits you ate : ")

 if number_of_biscuits>5:
  return 1

 elif number_of_biscuits<5:          
  return -1

 else:
  return 0

print greater_less_equal_5()

It almost works, except that raw_input gives you a string.

so you would need to convert to integer, but this might result in an error

so then I would move getting and validating the input to its own function

Not against your code, but against the exercise, to make a function that only compares against a single number is stupid. I would then simply to do:

def greater_less_equal(to=5):

or something like that. Now we can compare to any number, be we default 5. Which is a lot more re-usable.

Thank you so much for the detailed explanation!!