<jupyter_start><jupyter_text>Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All).Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as well as your name and collaborators below:<jupyter_code>NAME = ""
COLLABORATORS = ""<jupyter_output><empty_output><jupyter_text>---  Lab 1This is the first lab of Data 100 and is intended to ensure that you have your Jupyter Hub and/or local Notebook environments configured correctly.This assignment should be completed before Tuesday 23:00 at 1:00AM.  Imports<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Exercices  Part AWrite a function that returns a list of numbers, such that $ x_i=i^2 $,for $1\leq i \leq n$. Don't worry about the case where $n < 0$.<jupyter_code>def squares(n):
    """
    Compute the squares of numbers from 1 to n, such that the 
    ith element of the returned list equals i^2.
    """
    # YOUR CODE HERE
    raise NotImplementedError()<jupyter_output><empty_output><jupyter_text>Your function should print `[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]` for $n=10$.  Check that it does:<jupyter_code>squares(10)<jupyter_output><empty_output><jupyter_text>Check that squares returns the correct output for several inputs.<jupyter_code>assert squares(1) == [1]
assert squares(2) == [1, 4]
assert squares(10) == [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]<jupyter_output><empty_output><jupyter_text>Part BWrite a function which takes in a string and returns `True` if the string is a palindrome. (A string is a palindrome if it is the same forwards and backwards.)<jupyter_code>def is_palindrome(word):
    """Return True if word is a palindrome"""
    # YOUR CODE HERE
    raise NotImplementedError()<jupyter_output><empty_output><jupyter_text>Your function should return true for "racecar".<jupyter_code>is_palindrome("racecar")<jupyter_output><empty_output><jupyter_text>Check that the function works for several inputs.<jupyter_code>assert is_palindrome("aviddiva") == True
assert is_palindrome("clearlynotapalindrome") == False
assert is_palindrome("kayak") == True<jupyter_output><empty_output><jupyter_text>Part CRun the following code to see a pretty plot.<jupyter_code>from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt


# Create a plot
u = np.linspace(1.5*np.pi, -1.5*np.pi, 100)
[x,y] = np.meshgrid(u, u)
z = np.cos( np.sqrt(x.flatten()**2 + y.flatten()**2) ).reshape(x.shape)


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Plot a basic wireframe.
ax.plot_wireframe(x, y, z, rstride=10, cstride=10)
ax.view_init(elev=50., azim=30)
plt.savefig("figure1.pdf")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11264209438511884, 'fraction_numerical': 0.029968997588701342, 'mean_word_length': 5.753488372093023, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '378557', 'license': 'MIT', 'n_tokens_mistral': 1082, 'n_tokens_neox': 997, 'n_words': 316, 'path': 'lab/lab01/lab01/lab01.ipynb', 'repo_name': 'joeytai/DS100', 'size': '2903'}