From f97f4093f1b27c6c6584a80123c4dfa9aa6a2399 Mon Sep 17 00:00:00 2001 From: Sarvesh-yadav <44526730+Sarvesh-yadav@users.noreply.github.com> Date: Sun, 24 Mar 2019 11:47:10 +0530 Subject: [PATCH] Explained Nested if-else condition (#32369) * Explained Nested if-else condition Explained what is if-else condition and how to use it * fix: formatted code and output --- .../python/if-elif-else-statements/index.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/guide/english/python/if-elif-else-statements/index.md b/guide/english/python/if-elif-else-statements/index.md index 82048d434d..650e93b321 100644 --- a/guide/english/python/if-elif-else-statements/index.md +++ b/guide/english/python/if-elif-else-statements/index.md @@ -138,4 +138,24 @@ while keep_playing == "True": elif pmove == "scissors" and cmove =="paper": print ("Player wins") + ``` +Nested if else condition +Sometime we need to check another condition once one condition is satisfied. +For Example: If you wanted to check the range between which the given number falls.You will need to use nested if-else conditon +```python +x=63 +if x<=100: + if x>=90: + print("number fall between 100 and 90") + elif x>=80 & x<90: + print(Number is greater than 80 but less than 90") + else: + print("number is less than 80") +else: + print("number is greater than 100") +``` +output: +``` +number is less than 80 +``` \ No newline at end of file