Python for Developers

First Edition

Exercises I


1. Implement the two functions:

  • One that converts temperature in degrees Celsius to degrees Fahrenheit.
  • Anthoer that converts temperature in degrees Fahrenheit to degrees Celsius.

Keep in mind that:

$$F = \frac{9}{5} \cdot C + 32$$

2. Implement a function that returns true if the number is prime (false otherwise). Test from 1 to 100.

3. Implement a function that takes a list of lists of any length and returns a list of one dimension.

4. Implement a function that takes a dictionary and returns the sum, average and range of its values​​.

5. Write a function that: Gets a phrase as a parameter. Returns a new sentence with each word with the letters reversed.

6. Create a function that:

  • Gets a list of tuples (data), an integer (key, by default equal to zero) and a boolean (reverse, false by default).
  • Returns data sorted by item indicated by key in descending order and if reverse is true.
In [1]:
 
Out[1]: