Congratulations!

Introduzione a Python per sviluppatori

Jasmin Ludolf

Senior Data Science Content Developer

Chapter 1 recap

# Define quantity
quantity = 10

# Single quotes ingredient_name = 'pasta'
# Double quotes also work ingredient_name = "pasta"
Introduzione a Python per sviluppatori

Chapter 2 recap

ingredient_name = "Basil Leaves"


# Convert to lowercase ingredient_name = ingredient_name.lower()
# List of ingredients
ingredients = ["pasta", "tomatoes", "garlic",
               "basil", "olive oil", "salt"]

# Get the value at the first index ingredients[0]
# Creating a dictionary
recipe_dict = {"pasta": 500,
               "tomatoes": 400, 
               "garlic": 15,
               "basil": 20, 
               "olive oil": 30,
               "salt": 5}
# Create a set
ingredients_set = {"pasta", "tomatoes", "pasta", 
                   "basil", "garlic", "olive oil",
                   "salt"}

# Create a tuple serving_sizes = (1, 2, 4, 6, 8)
Introduzione a Python per sviluppatori

Chapter 3 recap

Operator Function
== Equal to
!= Not equal to
> More than
>= More than or equal to
< Less than
<= Less than or equal to
Keyword Function Use
if If condition is met First in the workflow
elif Else check if condition is met After if
else Else perform this action After elif
Introduzione a Python per sviluppatori

Chapter 3 recap

# Ingredients list
ingredients = ["pasta", "tomatoes", "garlic", "basil", "olive oil", "salt"]


# Loop through and print each ingredient for ingredient in ingredients:
print(ingredient)
pasta
tomatoes
garlic
basil
olive oil
salt
Introduzione a Python per sviluppatori

Chapter 3 recap

ingredients_to_add = 5
items_added = 0

while items_added < ingredients_to_add:
    items_added += 1
    remaining = ingredients_to_add - items_added

    if remaining > 3:
        print("Several ingredients remaining")
    elif remaining >= 1:
        print("Almost done!")
    else:
        print("Shopping list complete!")
Introduzione a Python per sviluppatori

Chapter 3 recap

Keyword Function
and Evaluate if multiple conditions are true
or Evaluate one or more conditions are true
in Evaluate if a value is in a data structure
not Evaluate if a value is not in a data structure

 

  • list.append()
Introduzione a Python per sviluppatori

Next steps

  • Additional built-in functions

    • zip()
    • enumerate()
  • Packages and modules

    • os
    • time
    • venv
    • pandas
    • requests
    • numpy
  • Building custom functions

$$

  • Intermediate Python for Developers course on DataCamp
Introduzione a Python per sviluppatori

Congratulations!

Introduzione a Python per sviluppatori

Preparing Video For Download...