#this program repeatedly asks for a year and prints
#the number of days in that year.it quits when it
#gets a year prior to 1800
def isLeapYear(y):
if y%400 = 0:
return True
elif y%100 = 0:
return False
elif y%4 = 0:
return True
else:
return False
def day
#This asks for a pattern then loops through the dictionary file
#Print all words containing that pattern
def fitsPattern(word,pattern):
#if word contains pattern, returns True
for letter in pattern:
if letter not in word:
return False
else:
i = word.find(
#Asks for upper limit and print all primes less than that
def isPrime(n):
#returns true if prime
for x in range(2, n):
if n%x = 0:
return False
return True
def main():
u = eval(input("Enter an upper limit:")
lineCount = 0
for i in range(2,u):
if isPrime(i
def Pay(month, amount, balance):
# This just prints a statement about one month's payment.
print( "In month %3d pay $%.2f, leaving a balance of $%.2f" %(month, amount,
balance)
def Interest(rate, amount):
# This computes the monthly interest on the given
# This looks through the dictionary
# for words with a lot of consecutive vowels
def AllVowels( w ):
# This returns True if string w contains only vowels
for letter in w:
if letter not in "aeiou":
return False
return True
def HasConsecutiveVowels(s, n):
#
CSCI 374 Machine Learning and Data Mining
Oberlin College Fall 2016
Homework #2: Nave Bayes
Important Dates
Assigned: October 14
Snapshot 1: October 28 (11:59 PM)
Snapshot 2: November 4 (11:59 PM)
Final Due Date: November 7 (11:59 PM)
Assignment
In this a
CSCI 374 Machine Learning and Data Mining
Oberlin College Fall 2016
Homework #3: Neural Networks
Important Dates
Assigned: November 14
Final Due Date: November 28 (11:59 PM)
Assignment
In this assignment, you will practice:
1) working with APIs for existi
CSCI 374 Machine Learning and Data Mining
Oberlin College Fall 2016
Homework #1: Decision Trees
Important Dates
Assigned: September 21
Snapshot 1: September 28 (11:59 PM)
Snapshot 2: October 5 (11:59 PM)
Final Due Date: October 10 (11:59 PM)
Assignment
In
24/08/2016
AmericanHeartAssociationScientificSessions2016
Step4
PAYMENT
Step5
THANKYOU!
RegistraonConrmaon
PLEASE PRINT OUT THIS SCREEN FOR YOUR RECORDS. IT IS YOUR CONFIRMATION AND
RECEIPT.
YOU WILL NEED THE QR CODE ON THIS RECEIPT TO ACCESS YOUR BADGE A
#This reads a list of numbers from the user
#Terminated by a negative number
#Prints the average of the numbers
def main():
sum = 0
count = 0
done = False
while not done:
x = eval(input("Number:")
if x < 0:
done = True
else:
sum = sum + x
count = count +
def main():
string = input("Enter a string:")
count = 0
for letter in string:
if letter in "aieou":
count=count+1
print("'' has 0 vowels." % (string, count)
main()
def main():
done=False
while not done:
year=eval(input("Enter a year after 1752:")
if year < 1753:
done = True
else:
if year%400=0:
isLeapYear=True
elif year%100=0:
isLeapYear=False
elif year%4=0:
isLeapYear=True
else:
isLeapYear=False
if isLeapYear:
prin
#This asks for a number and determines whether it's prime or not.
def main():
Top=eval(input("Last number to check:")
N = 2
lineCount = 0
while N <= Top:
d = 2
isPrime = True
while d < N:
if N % d = 0: # d divides evenly into N
print("0 divides into 0." %
#Prints a calendar for a month
def main():
name=input("What is the name of the month?")
length=eval(input("How many days are in it?")
print("What day does it start on?")
startsOn=eval(input("Enter 0 for Sunday, 1 for Monday, etc.")
print(name)
for day in
#This asks the user for a number N and tosses a coin N times
#Prints the longest run of consecutive headss
import random
def main():
N = eval(input("How many tosses?")
count = 0 # how many tosses made
currentRun = 0 # current number of consecutive heads
l
#This asks for a number and determines whether it's prime or not.
def main():
N=eval(input("Enter a number greater than 1.")
d = 2
isPrime = True
while d < N:
if N % d = 0: #0 divides evenly into N
print("0 divides into 0." % (d, N)
isPrime = False
d = d+
#This program asks user to enter a string
#Prints the individual words of the string and counts how many words
def main():
sentence = input("Give me a string")
wordCount = 0
done = False
while not done:
if sentence = ":
done= True
else:
index = sentence.f
#Asks number until user inputs 0
#For each number it prints all the factors
def main():
done = False
while not done:
N=eval(input("Give me a number.")
if N = 0:
done = True
else:
for x in range(1,N+1):
if N%x = 0:
print(x,end = " ")
print()
main()
#This reads grades.txt and prints the name
#of every student whose grade is above average
def main():
F=open("grades.txt","r")
total=0
count=0
for line in F:
line = line.strip()
[name,grade]=line.split()
total=total+eval(grade)
count=count+1
avg=total/cou
CSCI 383 Fall 2007
Proof Technique: Showing a Language is Regular
Main Steps
The 4 main steps for proving a language A is regular is as follows:
Step 1: Construct a FA. Construct a nite automaton M (either DFA or NFA) that you believe recognizes A, that i
CSCI 383 Fall 2007
Proof Technique: Games with Demons
Main Steps
The 4 main steps for proving a language A is not regular is as follows:
Step 1: Demon Picks k 0. You are given some pumping length k 1.
Step 2: You pick xyz. Select x, y, z such that xyz A a
CS 341 (Algorithms)
Pseudocode
In the text and lectures, algorithms will often be expressed in pseudocode, a mixture of code
and English (for specic not necessarily good examples of particular pseudocodes, see p. 17 of
the course text, or the examples in
CSCI 383 Fall 2007
Proof Technique: Induction
Main Steps
The 5 main steps for an induction proof are as follows:
Step 1: State your P (n). State your P (n), which should be a property as a function of n. Also
state for which n you will prove your P (n) to
CSCI 383 Fall 2007
Proof Technique: Contradiction
Main Steps
The 4 main steps of a proof by contradiction are as follows:
Step 1: State your goal. State what property P you are trying to prove.
Step 2: Assume the contrary. Assume that P is not true, by wa
CSCI 383 Fall 2007
Schedule Attempt #1
The following is a tentative schedule up to Thanksgiving. Ill try to stick to it as much as possible,
but I suspect it is a leeeetle ambitious.
Date
Sept 5
7
Sept 10
12
14
Sept 17
19
21
Sept 24
26
28
Oct 1
3
5
Oct. 8
CSCI 383 Fall 2007
Schedule Attempt #3
Here is an updated tentative schedule up to Dec. 3. More updates to follow!
Date
Sept 5
7
Sept 10
11
12
14
Sept 24
26
27
28
Oct 1
Oct 1
3
4
5
Oct 15
17
19
Oct 29
Oct 31
Nov. 2
Nov. 5
Nov. 7
8
9
Nov 12
14
16
Nov 19
No