Menu
Incident Response Forensics
number = 5
if number == 5: print("Number is 5") else: print("Number is Not 5") Truthy and Falsy Value: Eg; Any number other than 0 has truthy value Eg: Empty string is falsy value python_book = True if not python_book: print("This will not execute") Multiple If Conditions: number = 3 python_book = True if number = =3 and python_book: print("This will work") if number == 17 or python_book: print("This will work too") Ternary if Statements a = 1 b =2 "bigger" if a > b else "smaller" Note: This can be super helpful in list comprehension. Comments are closed.
|
Archives
April 2020
Categories |