Exercises on conditional statements

For background, please read the 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':

x = 10
x > 4:
    print('x greater than 4')
  File "/var/folders/_7/h5j1wn6n2b5c2qwh5dtr3jlm0000gq/T/ipykernel_20774/611279107.py", line 2
    x > 4:
          ^
SyntaxError: invalid syntax

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

p = -2
if p < 0
    p = p * 4
print(p)
  File "/var/folders/_7/h5j1wn6n2b5c2qwh5dtr3jlm0000gq/T/ipykernel_20774/1120584986.py", line 2
    if p < 0
            ^
SyntaxError: invalid syntax

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

a = 24
if a / 6 == 4:
print('a divided by 6 is 4')
  File "/var/folders/_7/h5j1wn6n2b5c2qwh5dtr3jlm0000gq/T/ipykernel_20774/3787299749.py", line 3
    print('a divided by 6 is 4')
    ^
IndentationError: expected an indented block

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.

# Try for different values of voter
voter = 'Hard Brexit'
# Your code here
if voter ...
  File "/var/folders/_7/h5j1wn6n2b5c2qwh5dtr3jlm0000gq/T/ipykernel_20774/1460183362.py", line 4
    if voter ...
             ^
SyntaxError: invalid syntax