CODING AND CLINICAL REASONING EXERCISE

Coding Introduction 

Below you will find programming exercises that we would like you to undertake.  The goal is to demonstrate your thinking and your ability to reason around problems.

Answer as much as you can and please send your responses in a zip file with your functions and tests.  You may be asked to explain your reasoning.

Good resources to help you are:

Hints and tips:

  • Error handling is fundamental
  • Use python as your expression language
  • Test your code and include tests in your solution
  • Comment your code and make sure it is easy to follow

Exercise 1

Write a function that, when given an int, prints a triangle like the one below

>>> print_triangle(size=6)

*
**
***
****
*****
******

>>> print_triangle(size=3)

*
**
***

>>> print_triangle(size=0)

>>> print_triangle(size=-4)

****
***
**
* 

Exercise 2

Write a function that, when given a triangle, returns its size.

The function should ignore empty lines.

>>> first_triangle = """

*
**
***
****
*****
******
*******


"""

>>> read_triangle(first_triangle)

Triangle size: 7

>>> second_triangle = """

**
*
"""

>>> read_triangle(second_triangle)

Triangle size: -2

>>> third_triangle = ""
>>> read_triangle(third_triangle)

Triangle size: 0

>>> not_a_triangle = """

***
***
"""

>>> read_triangle(not_a_triangle)

Shape is not a triangle 

Exercise 3

Write a function that, given a list, returns the sum of its three largest items.

>>> sum_three_largest_items([2, 8, -56, 100, 7])

115 

Exercise 4

Write a function that, given a list, returns the sum of its three largest absolute value items.

>>> sum_three_largest_absolute_value_items([2, 8, -56, 100, 7])

52 

Exercise 5

Write a function that, given a game of RPS7, determines the winner.

The function should accept the seven keyword arguments rock, fire, water, air, sponge, scissors, paper, as booleans.

Read more about RPS7 here: http://www.umop.com/rps7.htm

>>> winner_rps7(rock=true, fire=true)

rock

>>> winner_rps7(water=true, sponge=true)

sponge

>>> winner_rps7(water=true, air=true, paper=true)

Error: invalid arguments

>>> winner_rps7(water=true, air=true, paper=false)

air 

Exercise 6 (Optional)

Write a function that, given a large map of a field with rocks (represented with “o”) draws the largest square possible on the map.

Note: if several squares are possible, draw the one to the top left.

>>> map_of_field = """

--------------------------
-----o-----o----------o---
-o------o------o-------o--
--------o---o--o---o--o---
---o--o-------o-o---------
---o----------------------
----------------------o---
---o------------o---------
-----o-----o--o--o--o----
-------o-----------o------

"""

>>> largest_square(map_of_field)

--------------------------
-----o-----o----------o---
-o------o------o-------o--
--------o---o--o---o--o---
---o--oxxxxx--o-o---------
---o---xxxxx--------------
-------xxxxx----------o---
---o---xxxxx----o---------
-----o-xxxxxo--o--o--o----
-------o-----------o------ 

Clinical Reasoning Introduction

Below you will find two exercises:
  1. Diagnose three patients with different symptoms
  2. Clinical logic flow exercise

 

Exercise 1

You are to determine the likely diagnoses of these patients based on the symptoms they present.
 
Answer as much as you can and please send your documented responses to us.
 
Good resources to help you are:
Hints and tips:
  • Always reference your evidence sources
  • Highlight inconsistencies in your evidence, if any

 

Patient 1:

A patient phones in and asks for your advice. He recently visited a friend in their home and they had dinner together. That was 5 days ago.

This morning he felt tired and had a headache when waking up. As he was getting some water he noticed that his puppy relieved herself in a corner at some point throughout the night. Unusually, he could not smell anything. However, the cleaning products made him cough and he has not stopped coughing for four hours now.

He is worried he breathed in some cleaning product and that he should visit a clinic to get help.

Should he visit a clinic?
What is the likely diagnosis?
 
Patient 2:

A patient comes into the clinic, with a heavy limp. She tells you that she fell over during a rugby game and hurt her right ankle.

She is worried it might be broken.

You ask the patient to sit down, ask for consent to examine her ankle, and palpate (touch) around the ankle. The patient does not react, or report any pain, except when you feel alongside the achilles tendon.

You are able to trace the bone and the space where the tendon sits offers no resistance.

What is the likely diagnosis?
 
Patient 3:

In a consultation with a 58 year old woman, she presents a black skin lump with uneven edges. She reports that it appeared about two months ago and has been growing. A week ago she noticed that it bled and oozed a clear liquid.

You ask her about her previous medical history. There is nothing remarkable. She reports moving from Australia in her early 20s. Since coming to the UK she has been careful to apply plenty of sunscreen whenever she has gone outside. She has also eaten well and exercised regularly.

What is the likely diagnosis?

Exercise 2

Please write the logic for taking a patient history where the patient presents with symptoms where the diagnosis is likely to be one of the following:

  1. The common cold
  2. Influenza
  3. COVID-19

Include any appropriate tests, management and referrals, and any red flags they should consider.

You can use a structure such as the following, or write structured English, or pseudocode.