The general form of an if statement is as follows:
if «condition»: «block»
As with function bodies, the block of statements inside an if
must be indented by four spaces.
num = int(input("Enter an integer. "))
if num < 0:
print("There is no square root of", num)
print("You entered", num)
The 4 space indentation becomes a block. |
|