Congratulations

Intermediate Python for Developers

George Boorman

Curriculum Manager, DataCamp

Chapter 1 recap

  • Built-in functions
    • print(), help(), type()
    • max(), min(), sum()
    • len(), round(), sorted()
  • Modules
    • collections, string,
    • os, logging, subprocess

 

  • Packages
    • pandas
Intermediate Python for Developers

Chapter 2 recap

# Create a custom function
def average(values):
    # Calculate the average
    average_value = sum(values) / len(values)

    # Round the results
    rounded_average = round(average_value, 2)

    # Return rounded_average as an output
    return rounded_average
Intermediate Python for Developers

Chapter 2 recap

# Create a custom function
def average(values, rounded=False):

# Round average to two decimal places if rounded is True if rounded == True: average_value = sum(values) / len(values) rounded_average = round(average_value, 2) return rounded_average
# Otherwise, don't round else: average_value = sum(values) / len(values) return average_value
Intermediate Python for Developers

Chapter 2 recap

def average(values):
    """
    Find the mean in a sequence of values and round to two decimal places.

    Args:
        values (list): A list of numeric values.

    Returns:
        rounded_average (float): The mean of values, rounded to two decimal places.
    """

average_value = sum(values) / len(values) rounded_average = round(average_value, 2) return rounded_average
Intermediate Python for Developers

Chapter 2 recap

# Use arbitrary positional arguments
def average(*args):
    average_value = sum(values) / len(values)
    rounded_average = round(average_value, 2)
    return rounded_average

# Use arbitrary keyword arguments def average(**kwargs): average_value = sum(kwargs.values()) / len(kwargs.values()) rounded_average = round(average_value, 2) return rounded_average
Intermediate Python for Developers

Chapter 3 recap

  • lambda argument(s): expression
names = ["john", "sally", "leah"]

# Apply a lambda function inside map()
capitalize = map(lambda x: x.capitalize(), names)

# Convert to a list
list(capitalize)
['John', 'Sally', 'Leah']
Intermediate Python for Developers

Chapter 3 recap

ValueError output confirming that the string 'Hello' cannot be converred to a float

Intermediate Python for Developers

Chapter 3 recap

  • try
  • except
  • raise
Intermediate Python for Developers

Next steps

  • Additional built-in functions

    • zip()
    • input()
    • reduce()
    • filter()
  • More packages and modules

    • time
    • venv
    • requests
    • fastapi
  • Object-oriented programming
Intermediate Python for Developers

Congratulations!

Intermediate Python for Developers

Preparing Video For Download...