Home > other >  if statement giving errors when ran but not in idle
if statement giving errors when ran but not in idle

Time:07-26

I making a if statement for my program and when it runs it gives an error. This is my code:

if num1 = num2:
    print('Equal')

CodePudding user response:

when you compare in python its == not =

CodePudding user response:

Basically, you've mixed up thw two operaters. = is used for assignment(such as x = 5). == is used to compare two values(like comparing x == y).

  • Related