Python Libraries:
Math Library:
Purpose: The math library allows a person to perform mathematical operations
My two favorite functions:
- math.sqrt(): This function returns the square root of any number. To use it, the person would input a number into the parentheses, and the output would be the answer. For example, math.sqrt(25) would return 5.0.
- math.add(): This function adds 2 or more numbers together. To use it, a person would put the set of numbers into the parentheses seperated by a comma.
Random Library:
Purpose: The random library is used for generating random numbers and performing random operations in Python.
My two favorite functions:
- random.randint(a, b): This function generates a random integer between ‘a’ and ‘b’. To use it, the coder would input two numbers seperated by a comma, into the parentheses. The first number would be the minimum of the random number, and the second would be the maximum.
- random.choice(): This function selects a random element from the sequence seq, which can be a list, tuple, or string. It’s useful for random selection, e.g., picking a random item from a list.
Turtle Library:
Purpose: The turtle library is a fun and educational library for creating drawings and simple graphics using a turtle that moves around the screen.
My two favorite functions:
- turtle.forward(): This function moves the turtle forward by a specified distance. It’s used for creating various shapes and drawings.
- turtle.circle(): This function instructs the turtle to draw a circle with the given radius that will be specified in the parenthesis. You can use it to create circular patterns.
API: NASA API (Astronomy Pictures)
Something unique:
One unique feature of the NASA API is that it provides a new astronomy picture every day as well as a detailed explanation written by a professional astronomer. It covers a wide range of celestial objects and phenomena, making it an exciting resource for space enthusiasts.
Type of API:
It is a space and astronomy data API.
Function:
The NASA API allows developers to retrieve daily images and information about various astronomical phenomena, including stars, planets, galaxies, and space missions.
Scenario:
A potential scenario for using the NASA API is to create an app that displays the Astronomy Picture of the Day (APOD) along with a description. Users can receive new images and educational information about space every day.
Data Manipulation
import random
# import the librariy "random"
number = random.randint(1,50)
#created a variable named "number" that generates a number 1-50
print(number)
20