Is_int: IndentationError


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/isint?link_content_target=interstitial_lesson

<In what way does your code behave incorrectly? Include ALL error messages.>
File “python”, line 3
return True
^
IndentationError: expected an indented block

<What do you expect to happen instead?>

```python
def is_int(x):
    if x - round(x) == 0:
      return True
    else:
      return False
  
is_int(2.5)

Replace this line with your code.

<do not remove the three backticks above>

#2

Back off all your indentation and replace it with four space intervals.


#3

this is how my code really looks, there is smth wrong with copy/paste:

were you referring to this?


#4
def is_int(x):
    if x - round(x) == 0:
        return True
    else:
        return False

Use four spaces, religiously so it becomes a habit.


#5

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