Python If Statements

## Description

Here we will write a Sage subroutine containing an if/else statement. The subroutine will determine if a number passed to it is odd.

## Sage Cell

#### Code

```
def isOdd(n):
if (n % 2 != 0):
return true
else:
return false
```

## Options

#### If Comparators

When making a comparison there are a total of 6 comparators you may use. Here is the math notation and the Sage equivalent:

- $>$ is
`>` - $<$ is
`<` - $\geq$ is
`>=` - $\leq$ is
`<=` - $=$ is
`==` - $\neq$ is
`!=`

Note that equality is determined with a double equals sign, `==`. If statements can also be controlled with boolean variables.

## Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

## Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

## Attribute

Permalink:

Author:

Date: 12 Mar 2019 17:37

Submitted by: Zane Corbiere