Statements
• Code is made up of
statements
• A statement performs a
particular action.
• A "line of code" is roughly
the same as a statement
while True: # infinite loop
print('Time checked:', datetime.datetime.utcnow().isoformat())
with open('last_run.txt', 'rt', encoding='utf-8') as fileObject:
date_last_run = fileObject.read()
print('Date last run:', date_last_run)
date_now_utc = generate_utc_date()
print('UTC date now is:', date_now_utc)
if date_now_utc > date_last_run:
run_all_queries()
# Update the date last run
with open('last_run.txt', 'wt', encoding='utf-8') as fileObject:
fileObject.write(generate_utc_date())
print('done')
print()
# wait an hour before checking again
sleep(3600)
# Relationship between age of starting smoking and closeness
# create a factor out of closeness, box and whisker plot, then t-test of means
closeness_factor <- factor(with_maternal$maternal_closeness,
levels = c(0, 1),
labels = c("distant", "close"))
plot(with_maternal$H4TO2 ~ closeness_factor)
t.test(with_maternal$H4TO2 ~ closeness_factor, var.equal=TRUE, conf.level=0.95)
# Relationship between number of days/month smoking and closeness
plot(with_maternal$H4TO5 ~ closeness_factor)
t.test(with_maternal$H4TO5 ~ closeness_factor, var.equal=TRUE, conf.level=0.95)
R code
Python code
a statement
a statement