What's purpose of nested if in Python ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's purpose of nested if in Python ?

6th Dec 2019, 4:58 AM
Yusof
Yusof - avatar
2 Answers
+ 3
im python or in any other language, nested if is normally used where multiple levels of conditions are apply like multiple or single conditions inside a condition.simple ex: do you live in asia (if yes) { do you live in India(if yes) { 1. do you live in mumbai? 2. do you live in delhi? .....and so on... } do you live in china(if yes) { 1. do you live in Shanghai? 2. do you live in Beijing? ... and so on... } and as many conditions you want to check... } you can make any number or levels as you want.. i hope it helps...
6th Dec 2019, 8:18 AM
Pradeep Kumar Prajapati
Pradeep Kumar Prajapati - avatar
6th Dec 2019, 8:20 AM
Yusof
Yusof - avatar