Page 254 - COPA VOL II of II - TP -Punjabi
P. 254
ਉਦਾਹਰਨ 2 : ਜਾਂਚ ਕਰੋ ਕਭ ਕੀ ਇੱਕ ਸਤਰ ਪੈਲਭੰਡਰੋਮ ਹੈ ਜਾਂ
ਨਹੀਂ (ਚਭੱਤਰ 1)
# python program to illustrate nested If statement # Will only be executed if statement above
#!/usr/bin/python # it is true
i = 10 i f (i < 12):
if (i == 10): print(“i is smaller than 12 too”)
# First if statement e lse:
i f (i < 15): print(“i is greater than 15”)
print(“i is smaller than 15”) Output:
# Nested - if statement i is smaller than 15
i is smaller than 12 too
240 IT & ITES - COPA - (NSQF ਸੋਧੇ - 2022) - ਅਿਭਆਸ 1.40.06