Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions NumpyExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#convert the list of weights from a list to a Numpy array.
#Then, convert all of the weights from kilograms to pounds.
#Use the scalar conversion of 2.2 lbs per kilogram to make your conversion.
#Lastly, print the resulting array of weights in pounds.

weight_kg = [81.65, 97.52, 95.25, 92.98, 86.18, 88.45]

import numpy as np

# Create a numpy array np_weight_kg from weight_kg
np_weight_kg = np.array(weight_kg)


# Create np_weight_lbs from np_weight_kg

np_weight_lbs = np_weight_kg/2.2
# Print out np_weight_lbs
print(np_weight_lbs)