In Python, a single `=` is for assigning a value to a variable, while `==` checks if two values are equal, used in `if` statements. For example, `if a == 5:` checks, but `a = 5` makes it true. I know this because I just corrected a student at Didi's homestay who used `=` in his `if` statement and his discount calculator kept setting the price to zero instead of checking it.
#exams#study
Jump in to reply β no account needed.