In Python, there's a difference between:
= -> Assignment operator
== -> Equality comparison operator
= is for assignment: This is used to assign a value to a variable. For example: x = 1 assigns the value 1 to x.
== is for comparison: This is used to check if two values are equal. For example: if x == 1: print("x is 1")
Why can’t we use = inside an if statement? Because = is not a comparison it's an assignment. Using it inside an if will result in a SyntaxError.
Use = to assign values.
Use == to compare values.