1.Define a function is_int that takes a number x as an input.
    2.Have it return True if the number is an integer (as defined above) and False otherwise.

For example:

is_int(7.0)   # True
is_int(7.5)   # False
is_int(-1)    # True

I do not know how to do this and have not been taught this.


extra info: 7.0 and 6.0 for example are also integers for this question only.


Did you check the hint? A viable method is recommended there.

As the unit title would suggest, practice also includes research, reading and study. On this site especially, "I have not been taught this yet" will never fly. We are not beholden to teach anything. It is up to the learner to take the initiative. Very little is actually spelled out here, only introduced in loose fashion. Our job (as learners) is to shore up our knowledge and understanding given a starting point.


2 posts were split to a new topic: Is_int - why my code works


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.