# A variable name is a reference

Please note: all Python 3 example programs can be found here:

# Numeric Expressions (int)

## 3**2     # three to the power of two

```The % (modulus or modulo) operator yields the remainder from the division of the first argument by the second. The arguments may be floating point numbers, e.g., 3.14  %  0.7 equals 0.34 (since 3.14 equals 4 * 0.7 + 0.34.), ```

```or integer numbers, e.g., 5 % 2 equals 1 (since 5 equals 2 * 2 + 1.).```

`` ``

```Click here for info on when you might want to use the modulus operator.```

# Numeric Expressions (float)

## 3.0**2.0    # three to the power of two

```The % (modulus or modulo) operator yields the remainder from the division of the first argument by the second. The arguments may be floating point numbers, e.g., 3.14  %  0.7 equals 0.34 (since 3.14 equals 4 * 0.7 + 0.34.), ```

```or integer numbers, e.g., 5 % 2 equals 1 (since 5 equals 2 * 2 + 1.).```

`` ``

```Click here for info on when you might want to use the modulus operator.```

` `

` `

` `

` `

# Mixed Numeric Expressions

## 3**2.0    # three to the power of two

```The % (modulus or modulo) operator yields the remainder from the division of the first argument by the second. The arguments may be floating point numbers, e.g., 3.14  %  0.7 equals 0.34 (since 3.14 equals 4 * 0.7 + 0.34.), ```

```or integer numbers, e.g., 5 % 2 equals 1 (since 5 equals 2 * 2 + 1.).```

`` ``

```Click here for info on when you might want to use the modulus operator.```

` `

` `

# Boolean expressions result in values true or false

## 4 != 4

In expressions where there are a number of different operators, do some have precedence over others? Yes they do... For example, multiplications are always done before additions and subtractions.

# Converting one data type to another (int to str)

## Click on the following link to see how to use the + operator

to join together (concatenate) two strings or add together two numbers:

# Rounding a floating point number to the nearest integer

## # See program 03-13.py

# 03-13.py

# How to round up a floating point number

# to the nearest integer

# Updated: Monday 24th January 2011, 16:24 PT, AD

x = 1.6

print (x)

x = round(x)

print (x)

#compare the above with

x = 1.6

x = int(x)

print (x)

# This Presentation uses the following program files:

## 03-13.py

Please note: all Python 3 example programs can be found here: