GRADED A+
WRITTEN BY BRIAN KARIUKI
f1.read() - ANS>>read a file into a
string
f1.write("hello!") ANS>>writes to a
- file
f1.readline() -ANS>>reads next
line
f1.close() -ANS>>closes a file (must always close a
file!)
f1 = open("/my_path/my_file.text",ANS>>to open and read a
"r") - file
f1 = open("/my_path/my_file.text",ANS>>to open and write a file (all
"w") - previous
material
discarded)
f1 = open("/my_path/my_file.text",ANS>>to open and add to a
"a") - file
with open("/my_file...etc) as f:ANS>>opens, allows work, and automatically
- closes a
file
timedelta -ANS>>time library function to calculate time
amounts
from datetime importANS>>grabs timedelta from the datetime
timedelta - library
import datetime as dtANS>>imports a library as a specified
- variable
, datetime.date.today().monthANS>>to print current month (aka .day or .year for
- those)
beautiful soupANS>>HTML parsing
- library
NumPy - ANS>>scientific computing, matrices, array creation
library
pandas - ANS>>data manipulation and analysis
library
pillow (PIL) -ANS>>work with and manipulate images; python imaging
library
pyglet- ANS>>multimedia / gaming creation
library
pytz - ANS>>time zone data
library
pip install ____________ import- ANS>>to install and import
_______________ a
library into your
code
math.ceil() -ANS>>round down (4.5 = 4, 4.8 = 4, 4.1 = 4, 4.9 =
4)
math.floor() ANS>>round up (4.6 = 5, 4.7 = 5, 4.1 = 5, 4.2 =
- 5)
datetime.date.today() ANS>>get today's
- date
datetime.date.(1967, 9, 7)
print(mybday.strftime("%A")) - gets the day of the
ANS>> week
math.factorial() - ANS>>multiplies each number in argument to give answer
math.exp() - ANS>>return e raised to power of (x) (natural log)