0
can someone give me an example of when we would use nested if statements?
just trying to wrap my head around if statements
4 odpowiedzi
+ 4
when you have to check something that depends on another thing
if age > 18:
if > male:
do something
you can also use && or || which is “and” “or”
+ 3
It is used when you want to have a condition after passing a condition. For example if a want to test a number if it is less than 100 and even
if num < 100:
if num%2==0:
print("Yeah")
else:
print("Nope")
else:
print("Nope")
However, you rarely do this. Using and/or etc is much better. It's all explained in the tutorial. Please complete it.