signd = 1

if (d < 0):
    signd = -1
else:
    signd = 1



This is a simple if statement. We are using it to figure out if the discriminant sign is positive or negative. The code logic is to assign the variable signd a -1 if the value of d is negative. else assign the variable signd a positive sign. The formal syntax for the if statement is
if logical-expression:
      statement
      statement
In our case we also use else which is used if the logical expression fails:
if logical-expression:
      statement
      statement
else:
      statement
also note the indentation. The statements need to be indented either 4 spaces or simply hit Tab from you key board. A logical expression is one that evaluates to true or false. A nonzero numeric value is considered to be true, and a zero value, false. If the expression is true, the indented statement or statements are executed. Otherwise it is skipped. Here we are checking whether d is less than zero. We use the relational "is less than" < operator. comparison operators were introduced in the last class. They are attached below.
Note that logical operators can be combined using and & or as mentioned in last class and reattached here for example.
if (condition1 and conditoin2): 
    statement
for example
if( d<0 and a==1): 
	print("I found it")

In this statement you are printing a statement if the variable d was less than 0 and the variable a equals to 1.



Comparison operators

Comparison operator either return True or False. This will be particularly useful in while, conditional statements that we will learn in next class.
> Greater Than
< Less Than
== Equal 
!= Not Equal
>= Greater than or Equal to 
<= Less than or Equal 
Logical operators

and (&) True if both operands are true
or (|) True if either operands are true
start an emacs editor and create the file log-ope.py to your directory and run it.