Guide about if-else statements of Python concerning interview study.

7. What if you want to check if "at least one" thing is true? How does the word or work in an if condition? Can you give a simple example?


8. How can you check if something is not true in an if condition? What's the role of the word not?


9. In Python, do things like empty lists or the number zero count as true or false when you use them in an if condition? Can you give a few examples?


10. If you have a bunch of if and elif conditions, how does Python decide which part of the code to run? What happens once it finds a true condition?

11. What do you think will be the output of this piece of Python code and why?
x = 5
if x > 10:
	print("Greater than 10")
elif x > 5:
	print("Greater than 5")
else:
	print("Not greater than 5")
					


12. Could you please write a simple piece of Python code that takes two numbers and tells you which one is bigger? Makes use of if and else.


13. How could you create a Python program to find out whether a year is a leap year? (There are a few rules for this!). Use if, elif and else.


14. Do you sometimes place if statements in if statements? If yes, why? What are some common issues to watch out for concerning such often-used commands?


15. Should you have a number of different possibilities to check, of which only one can be true, would you use stack upon stack of if statements or one if elif else structure? Why?


16. There is a shorter way to write a simple one-liner if else in Python it is sometimes called ternary operator. Can it be explained and when you use it?


17. Will a really long list of elif conditions ever turn out to be a bad thing in your code? If so, what other methods might you use to deal with many cases?


18. When you have a few different things that need to be checked but aren't all that related to each other, would it be better to do one large if elif else block or separate if statements? Why?


19. Does having a lot of nested if statements or long chains of them slow down your program? What could help you with such cases?


20. What should you habitually do with your if statements, elifs and else's for neat, readable code?