Congratulations!

Introduction to Python for Developers

George Boorman

Curriculum Manager, DataCamp

Chapter 1 recap

Syntax Action Example Output
* Multiply 4 * 10 40
+ Addition 7 + 9 16
- Subtract 23 - 4 19
/ Division 27 / 3 9
** Power 3 ** 2 9
% Modulo 7 % 4 3
# Define total_spend
total_spend = 3150.96

# Single quotes customer_name = 'George Boorman'
# Double quotes also work customer_name = "George Boorman"
Introduction to Python for Developers

Chapter 2 recap

current_top_album = "For All The Dogs"


# Convert to lowercase current_top_album = current_top_album.lower()
# List of prices
prices = [10, 20, 30, 15, 25, 35]

# Get the value at the first index prices[0]
# Creating a dictionary
products_dict = {"AG32": 10, "HT91": 20, 
                 "PL65": 30, "OS31": 15, 
                 "KB07": 25, "TR48": 35}
# Create a prices set
prices_set = {10, 20, 30,
              15, 25, 35}

# Create a prices tuple prices_tuple = (10, 20, 30, 15, 25, 35)
Introduction to Python for Developers

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
Introduction to Python for Developers

Chapter 3 recap

# Prices list
prices = [9.99, 8.99, 35.25, 1.50, 5.75]


# Print each value in prices for price in prices:
print(price)
9.99
8.99
35.25
1.5
5.75
Introduction to Python for Developers

Chapter 3 recap

# Stock limit
stock = 10
# Number of purchases
num_purchases = 0

# While num_purchases < stock limit while num_purchases < stock:
# Increment num_purchases num_purchases += 1
# Print remaining stock print(stock - num_purchases)
Introduction to Python for Developers

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()
Introduction to Python for Developers

Next steps

  • Additional built-in functions

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

    • os
    • time
    • venv
    • pandas
    • requests
    • numpy
  • Building custom functions
Introduction to Python for Developers

Congratulations!

Introduction to Python for Developers

Preparing Video For Download...