is tests for identity, not equality. That means Python simply compares the memory address a object resides in. is basically answers the question “Do I have two names for the same object?”
so why would you use
to check if
x is of type int, you would need to use
type() and see of type
furthermore, for this exercise negative integer values and decimal zero (
7.0 for example) are also identified as integer,
int won’t consider them integers (otherwise, this wouldn’t be a challenge)
I see but then how would u get the program to accept values such as 7.0 to return True and -3.5 to return False?
that is the challenge. well, you learned several things: division operator (
/), modulo operator (
%) and absolute function (
abs) which could help you with this
Still can’t seem to do it This is what I’ve done so far and idk why my program isn’t returning True for -956.0 even though it should.
line 7, you get the absolute value using
abs, but don’t store the absolute value anywhere? So
x is still negative
so, to store it would i do x=abs(x) ?
that should update
x with the absolute value, yes
It worked! Thanks for the help man