---
jupyter:
  jupytext:
    metadata_filter:
      notebook:
        additional: all
        excluded:
        - language_info
    text_representation:
      extension: .Rmd
      format_name: rmarkdown
      format_version: '1.0'
      jupytext_version: 0.8.6
  kernelspec:
    display_name: Python 3
    language: python
    name: python3
  jupyterbook:
    run: false
---

# Exercises on conditional statements

For background, please read the [conditional
statements](../functions-conditionals/conditional_statements) introduction.

This *if statement* is not properly defined, and will give a `SyntaxError`.  Fix it, then run to confirm it prints `'x greater than 4'`:

```{python tags=c("raises-exception")}
x = 10
x > 4:
    print('x greater than 4')
```

This if statement also gives a `SyntaxError`. Fix and run. It should
print `-8`;

```{python tags=c("raises-exception")}
p = -2
if p < 0
    p = p * 4
print(p)
```

Another `SyntaxError`; fix and run.  It should print `a divided by 6
is 4`

```{python tags=c("raises-exception")}
a = 24
if a / 6 == 4:
print('a divided by 6 is 4')
```

We want an algorithm to choose a newspaper for someone to read in the
dentist's waiting room, given what we know about their views on
Brexit.

Write a cell that prints `Times` if `voter` has the value `Soft Brexit`,
otherwise prints `Telegraph` if `voter` has the value `Hard Brexit` otherwise
prints `Guardian` if `voter` has value `remain`, otherwise prints `No idea`.

```{python tags=c("raises-exception")}
# Try for different values of voter
voter = 'Hard Brexit'
# Your code here
if voter ...
```
