Gratulacje

Python dla programistów – poziom średniozaawansowany

Jasmin Ludolf

Senior Data Science Content Developer

Podsumowanie rozdziału 1

  • Funkcje wbudowane:
    • print(), help(), type()
    • max(), min(), sum()
    • len(), round(), sorted()
  • Moduły:
    • string, os

 

$$

  • Pakiety:
    • pandas
Python dla programistów – poziom średniozaawansowany

Podsumowanie rozdziału 2

# 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
Python dla programistów – poziom średniozaawansowany

Podsumowanie rozdziału 2

# 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
Python dla programistów – poziom średniozaawansowany

Podsumowanie rozdziału 2

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
Python dla programistów – poziom średniozaawansowany

Podsumowanie rozdziału 2

# Use arbitrary positional arguments
def average(*args):
    average_value = sum(args) / len(args)
    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
Python dla programistów – poziom średniozaawansowany

Podsumowanie rozdziału 3

  • lambda arguments: expression
names = ["john", "sally", "leah"]

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

# Convert to a list
print(list(capitalize))
['John', 'Sally', 'Leah']
Python dla programistów – poziom średniozaawansowany

Podsumowanie rozdziału 3

Wyjście ValueError potwierdzające, że ciąg 'Hello' nie może zostać przekonwertowany na float

$$

  • try
  • except
  • raise
Python dla programistów – poziom średniozaawansowany

Kolejne kroki

  • Więcej funkcji wbudowanych:

    • zip()
    • input()
    • reduce()
    • filter()
  • Więcej pakietów i modułów:

    • time
    • venv
    • requests
    • fastapi

Wprowadzenie do programowania obiektowego

  • Kluczowe przy tworzeniu oprogramowania na dużą skalę
Python dla programistów – poziom średniozaawansowany

Gratulacje!

Python dla programistów – poziom średniozaawansowany

Preparing Video For Download...