THE DFIR BLOG
Menu

Incident Response Forensics

If Statement- Basics

3/16/2018

 
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
    September 2019
    August 2019
    July 2019
    June 2019
    April 2019
    February 2019
    March 2018

    Categories

    All
    Aws
    Cloud
    Dfir
    Incident Response
    Linux
    Recon

    RSS Feed

  • Infosec
  • Mac Forensics
  • Windows Forensics
  • Linux Forensics
  • Memory Forensics
  • Incident Response
  • Blog
  • About Me
  • Infosec
  • Mac Forensics
  • Windows Forensics
  • Linux Forensics
  • Memory Forensics
  • Incident Response
  • Blog
  • About Me