-1

I am in the process of writing a script to check a table has been updated, but I am unsure how to implement the if else condition to check if A == True.

So far, I have written the following code:

Would be a big help if someone can help me implement the if else condition to check A == True.

  • Does this answer your question? [if x:, vs if x == True, vs if x is True](https://stackoverflow.com/questions/20420934/if-x-vs-if-x-true-vs-if-x-is-true) – jonsca Jun 02 '22 at 09:41

2 Answers2

0

If A is true, then the code block of the if condition will be excepted. Otherwise( A not equals True), the else code block will be expected. If you don't have to do when A doesn't equal True, then you don't need to use else.

if A == True:
    #Here write the code you want to be expected when A == True

else:
    #Here write the code you want to be expected when A doesn't equal True.
Mohammed
  • 1
  • 1
0

There's no need to go through all of the extra steps:

if df_check['last_day_loaded']==today_date:
    print("It is equal to today's date")
else:
    print("It's not equal to today's date")

Saying A = (df_check['last_day_loaded']==today_date) already sets A to true if it is today's date, and checking A==true is redundant.

jonsca
  • 9,627
  • 26
  • 54
  • 61