Problem 1
3 Python libraries
Turtle (good for making drawings/graphics)
turtle.forward() moves the turtle forward by a specific amount turtle.pendown() puts down the turtle’s pen so it can draw along its path
Beautiful Soup (good for web scraping)
from bs4 import BeautifulSoup soup = BeautifulSoup(html_doc, ‘html.parser’) # grabs data and represents it as a nested data structure
soup.title # outputs
Pyjokes (generate jokes)
myjoke = pyjokes.get_joke(language=”en”, category=”neutral”) language parameter specifies the language of the joke, and category specificies which category of the joke you want (neutral, twister, all)
Problem 2
Research an API
random.org API This API is unique in that it can generate random numbers within a specified range. It is free to use (1000 times per key) and is very useful for game development involving random numbers.
In a cryptography setting, one could use such an API to generate key values for decryption using the Ceasar Cipher, among many other hashing algorithms such as RSA.
Problem 3
import a data manipulation library use a prefixed function and prefixed variable, w/ comments
import pandas as p # we will use pandas library, assign it prefix p
p_var = p.Series([1,2,8,9,10]) # create pandas series with prefix p
p_result = p_var.mean() # use a prefixed function, mean (from the pandas library)
print(p_var) # original series
print(p_result) # mean calculated by the mean function from pandas library
0 1
1 2
2 8
3 9
4 10
dtype: int64
6.0