DEV Community

Nandhini
Nandhini

Posted on

If.. else.. in Python

In Python, the if statement allows us to run or skip a block of code based on specified condition.
Eg.,

raining = False

if raining == True:
       print("Take Umbrella")
else:
       print("No need")
Enter fullscreen mode Exit fullscreen mode

Output:
No need

Top comments (0)