Splitting IP Address string variable post defines the normal way how to deal with the variables and splitting them into different items. The same splitting can be used by using conditional statement if-else with while loop. This provides more simplicity for network engineers to shorten the python code.
Syntax of If-Else Statement:
if expression:
statement(s)
elif:
statement(s)
else
statement(s)
If expression is FALSE, in that case complier will move to the ELIF part. If ELIF becomes false also, the compiler will execute else block. The elif statement allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE.