Question
In Python!! 1.Importing Python modules Modules (sometimes called packages or libraries ) help group together related sets of tools in Python. In this exercise, we'll
In Python!!
1.Importing Python modules
Modules (sometimes called packages or libraries) help group together related sets of tools in Python. In this exercise, we'll examine two modules that are frequently used by Data Scientists:
- statsmodels: used in machine learning; usually aliased as sm
- seaborn: a visualization library; usually aliased as sns
Note that each module has a standard alias, which allows you to access the tools inside of the module without typing as many characters. For example, aliasing lets us shorten seaborn.scatterplot() to sns.scatterplot().
# Use an import statement to import statsmodels ____ ____ 2.
In this exercise, we'll learn to import numpy, a module for performing mathematical operations on lists of data. The standard alias for numpy is np.
What did you need to change to make the import run without errors?
# Fix the import of numpy to run without errors import NumPy as np
3.
Creating a float
Before we start looking for Bayes' kidnapper, we need to fill out a Missing Puppy Report with details of the case. Each piece of information will be stored as a variable.
We define a variable using an equals sign (=). For instance, we would define the variable height:
height = 24
In this exercise, we'll be defining bayes_age to be 4.0 months old. The data type for this variable will be float, meaning that it is a number.
# Fill in Bayes' age (4.0) ____
# Display the variable bayes_age ____(____)
4.
Creating strings
Let's continue to fill out the Missing Puppy Report for Bayes. In the previous exercise, we defined bayes_age, which was a float, which represents a number.
In this exercise, we'll define favorite_toy and owner, which will both be strings. A string represents text. A string is surrounded by quotation marks (' or ") and can contain letters, numbers, and special characters. It doesn't matter if you use single (') or double (") quotes, but it's important to be consistent throughout your code.
# Bayes' favorite toy ____
# Bayes' owner ____
# Display variables print(favorite_toy) print(owner)
Please help out~~
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started