# Lecture 12 – Quiz 1 Review¶

## Temperature conversion¶

Suppose we have a list of temperatures of cities around the world.

Remember, we already defined c_to_f, which takes a temperature in Celsius to a temperature in Fahrenheit.

How do we convert the 3rd temperature to Fahrenheit? The 9th temperature? The very last temperature in the list?

### Quick Check 1¶

Quick recap: while loops allow us to repeat a code block as long as some boolean expression is true.

Back to the question at hand: how do we make a new list with all temperatures converted to Fahrenheit?

## Stock prices¶

### Part 1¶

Task: Given a list of prices of a stock on a single day, return a string describing whether the stock increased, stayed the same, or decreased from its starting price.

### Part 2, Quick Check 2¶

Task: Given a list of prices of a stock on a single day, return True if the stock was strictly increasing, and False otherwise. A list of numbers is strictly increasing if each one is larger than the previous.

## More Practice¶

Given the side lengths of a triangle as a list (sides), return:

• 'equilateral' if all three side lengths are equal
• 'isoceles' if exactly two of the three side lengths are equal
• 'scalene' if all three side lengths are different

If any of the side lengths are less than or equal to 0, return 'invalid'.

Answer  def triangle_type(sides): if sides <= 0 or sides <= 0 or sides <= 0: return 'invalid' if sides == sides == sides: return 'equilateral' elif (sides == sides) or (sides == sides) or (sides == sides): return 'isoceles' else: return 'scalene'