Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
1491ff3
Merge pull request #1 from The-Knowledge-House/master
derekYankie Mar 30, 2016
9496e2e
Derek's first assignment
derekYankie Mar 30, 2016
b028817
Merge pull request #2 from The-Knowledge-House/master
derekYankie Apr 3, 2016
3a2368f
assignment2
derekYankie Apr 3, 2016
ce5cc1e
Derek's seond assignment
derekYankie Apr 3, 2016
b27438d
Delete Assignment2_Derek_Afriyie.py
derekYankie Apr 3, 2016
8e0f2be
Derek's second assignment
derekYankie Apr 3, 2016
10b8d90
Merge pull request #3 from The-Knowledge-House/master
derekYankie Apr 7, 2016
5d1508e
Assignment3.1
derekYankie Apr 12, 2016
3720256
Merge pull request #4 from The-Knowledge-House/master
derekYankie Apr 12, 2016
0b1538c
Assignment3
derekYankie Apr 12, 2016
cf0e148
assignment3
derekYankie Apr 12, 2016
4bedfa6
assignment3.1Fixed
derekYankie Apr 12, 2016
8d9b45f
Delete Assignment3.1_Derek_Afriyie.oy
derekYankie Apr 12, 2016
8afd37d
assignment3.3
derekYankie Apr 12, 2016
824cee1
3
derekYankie Apr 12, 2016
e37ac96
assignment4.6
derekYankie Apr 12, 2016
8334442
Merge pull request #5 from The-Knowledge-House/master
derekYankie Apr 15, 2016
80b5613
Assignment5.2
derekYankie Apr 22, 2016
e06f8f0
Assignment6.5
derekYankie Apr 22, 2016
965f9a2
Delete Assignment_5.2
derekYankie Apr 22, 2016
d54a542
Delete untitled
derekYankie Apr 22, 2016
4dada54
Merge pull request #6 from The-Knowledge-House/master
derekYankie Apr 22, 2016
0ad4556
Assignment7.1
derekYankie Apr 22, 2016
493e499
Assignments 7.3
derekYankie Apr 26, 2016
a794c2c
upadte to 7.3
derekYankie Apr 26, 2016
d4a1464
updates to 7.3,8.4,&8.5
derekYankie May 3, 2016
2c7247b
Derek 8.4 upload
derekYankie May 3, 2016
196d9de
Merge pull request #7 from The-Knowledge-House/master
derekYankie May 3, 2016
8dd2655
Upadting 7.3 and uploading 8.4,8.5
derekYankie May 5, 2016
afb5de3
updload 9.4 & tweaked 8.4
derekYankie May 7, 2016
7d71952
upadating 9.4 again
derekYankie May 10, 2016
c5b372d
uploading gitignore
derekYankie May 11, 2016
23f9f0d
10.2
derekYankie May 17, 2016
39e51c4
Merge pull request #8 from The-Knowledge-House/master
derekYankie May 17, 2016
d6bdd0c
new10.2
derekYankie May 19, 2016
26844e1
upload11.2
derekYankie May 19, 2016
447c331
Assignment 12 before breakfast
derekYankie May 19, 2016
6823c3c
10.2 but better
derekYankie May 19, 2016
fc48bfc
13.2 uploda
derekYankie May 20, 2016
044db39
reuploading 13.1
derekYankie May 21, 2016
ee1675d
Upload 13.2
derekYankie May 21, 2016
ec14f75
Merge pull request #9 from The-Knowledge-House/master
derekYankie May 21, 2016
f2cdcec
hw 14
derekYankie May 21, 2016
ce4a2bb
Merge pull request #10 from The-Knowledge-House/master
derekYankie May 24, 2016
2f5aae6
15.1 assignmnet
derekYankie May 25, 2016
247fac8
Assignment 15.2
derekYankie May 31, 2016
4599ae6
updaye 15.2
derekYankie May 31, 2016
678b60e
Merge pull request #11 from The-Knowledge-House/master
derekYankie Jun 1, 2016
66efa4f
Merge pull request #12 from The-Knowledge-House/master
derekYankie Jun 8, 2016
80eac02
Ast 16.1
derekYankie Jun 8, 2016
95b4e90
Ast 16.2
derekYankie Jun 9, 2016
635b9dc
Proper file name Ast 16.2
derekYankie Jun 9, 2016
43cc5d3
changed musical_track.py to Assign_17 and completed Assign_18
derekYankie Jun 15, 2016
1b5b8a1
How to create a database
derekYankie Jul 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
Slides/.DS_Store
48 changes: 48 additions & 0 deletions Assignment3.3_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#Assignment 3.3
#Write a program to prompt for a score between 0.0 and 1.0.
#If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade #using the following table:

"Score Grade"
">= 0.9 A"
">= 0.8 B"
">= 0.7 C"
">= 0.6 D"
"< 0.6 F"

#If the user enters a value out of range, print a suitable error message and exit. For the test
#enter a score of 0.85.

#Please begin writing the program with the code below:

score = float(raw_input("Enter Score: "))

s = score

#s = 0.85 #score
#Check to see if user entered a number between 0.0 and 1.0
try:
s >= 0.0 and s <=1.0
print 'Your score is:',score
except:
#Display error message
print 'Invalid number. Enter a number between 0.0-1.0'


if s>= 0.9:
#Prints A
print 'A'

elif s>= 0.8:
#Prints B
print 'B'
elif s>= 0.7:
#Prints C
print 'C'
elif s>= 0.6:
#Prints D
print 'D'
elif s< 0.6:
#Prints F
print 'F'
else:
print "Theres no score to give."
Binary file added Assignments/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions Assignments/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
Slides/.DS_Store
1 change: 1 addition & 0 deletions Assignments/Assignment1_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print "Hello World!"
6 changes: 6 additions & 0 deletions Assignments/Assignment2.Derek.Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#I OWE YOU PROGRAM
hours = raw_input("How many hours did you work?")
pay = raw_input("Enter pay rate")
total = float(hours) * float(pay)

print 'Hey I owe you', total
16 changes: 16 additions & 0 deletions Assignments/Assignment2_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Magic Dates program
#Derek Afriyie 03/30/2016
#Write a program that checks to see if the month & day
#of the user's birthday results in the year they were born

#Ask user for their month of birth and store in the variable month
year = int(raw_input("What year were you born?"))
"Ask user for their month of birth and store in the variable month"
month = int(raw_input("What month were you born?"))
day = int(raw_input("What day were you born?"))

#Checks
if (month * day) == year:
print "Your birthday is magical!"
else:
print "Theres nothing magical about your birthday"
29 changes: 29 additions & 0 deletions Assignments/Assignment3.1_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Assigmnet 3.1
#Write a program to prompt the user for hours and rate per hour using raw_input to compute gross pay.
#Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above #40 hours.
#Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75).
#You should use raw_input to read a string and float() to convert the string to a number.


#Do not worry about error checking the user input - assume the user types numbers properly.

"Please begin writing the program with the code below:"
#hrs = raw_input("Enter Hours:")
#h = float(hrs)
#rate = raw_input("Enter pay rate:")
#r = float(rate)
#Determine total pay based on numbers of hours worked"

h= 45
r = 10.50
#Condition for noraml hours worked
if h <= 40:
#Calculates total pay
gPay = h * r
#Display total pay
print 'Hey, I owe you', gPay
#Condition for overtime
elif h >= 40:
gPay = 40 * r + (r * 1.5 *( h-40))
#Display total pay for overtime
print 'Hey, you worked overtime. I owe you $', gPay
48 changes: 48 additions & 0 deletions Assignments/Assignment3.3_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#Assignment 3.3
#Write a program to prompt for a score between 0.0 and 1.0.
#If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade #using the following table:

"Score Grade"
">= 0.9 A"
">= 0.8 B"
">= 0.7 C"
">= 0.6 D"
"< 0.6 F"

#If the user enters a value out of range, print a suitable error message and exit. For the test
#enter a score of 0.85.

#Please begin writing the program with the code below:

score = float(raw_input("Enter Score: "))

s = score

#s = 0.85 #score
#Check to see if user entered a number between 0.0 and 1.0
try:
s >= 0.0 and s <=1.0
print 'Your score is:',score
except:
#Display error message
print 'Invalid number. Enter a number between 0.0-1.0'


if s>= 0.9:
#Prints A
print 'A'

elif s>= 0.8:
#Prints B
print 'B'
elif s>= 0.7:
#Prints C
print 'C'
elif s>= 0.6:
#Prints D
print 'D'
elif s< 0.6:
#Prints F
print 'F'
else:
print "Theres no score to give."
25 changes: 25 additions & 0 deletions Assignments/Assignment4.6_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#Assignment4.6


hrs = raw_input("Enter Hours:")
h = float(hrs)
rate = raw_input("Enter PayRate: ")
r = float(rate)

#compute function
def computepay(h,r):
grosspay = h * r
return grosspay



#print "Pay" , grosspay

#Regular Pay
if h <= 40 :
print computepay(h,r)
#Overtime
else:
grosspay = r * 40 + (r * 1.5 * (h - 40))

print "Gross Pay:" , computepay(h,r)
29 changes: 29 additions & 0 deletions Assignments/Assignment5.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Assignment 5.2

#Create a blank list
numList =[]
while True:
#Get user input
userNum = raw_input("Please enter interger numbers ")
try:
#Convert number into a decimal
userNum = float(userNum)

#Custom message when user doesn't input an intereger
except:
print "Sorry, please try to input a number this time."
#Condition to end while loop
if userNum == 'done':
#Exits/breaks out of the while loop
break
#Will jump back to the top of the loop
#To force the user to input a number
#In order for the program to proceed
else:
continue
numList.append(userNum)
if numList == []:
print "your set set is empty"
else:
print 'Greatest number is: ',max(numList)
print 'Smallest number is: ', min(numList)
29 changes: 29 additions & 0 deletions Assignments/Assignment5.2_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Assignment 5.2

#Create a blank list
numList =[]
while True:
#Get user input
userNum = raw_input("Please enter interger numbers ")
try:
#Convert number into a decimal
userNum = float(userNum)

#Custom message when user doesn't input an intereger
except:
print "Sorry, please try to input a number this time."
#Condition to end while loop
if userNum == 'done':
#Exits/breaks out of the while loop
break
#Will jump back to the top of the loop
#To force the user to input a number
#In order for the program to proceed
else:
continue
numList.append(userNum)
if numList == []:
print "your set set is empty"
else:
print 'Greatest number is: ',max(numList)
print 'Smallest number is: ', min(numList)
2 changes: 1 addition & 1 deletion Assignments/Assignment_10.2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello Fellows,
#Assignment10.4

Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages.
You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon.
Expand Down
50 changes: 50 additions & 0 deletions Assignments/Assignment_10.2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#Assignment10.4

"Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. "
"You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon."

"From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008"

"Once you have accumulated the counts for each hour, print out the counts, sorted by hour as shown below."


"Begin to write the program with the following code below:"
name = raw_input("Enter file:")
if len(name) < 1 :
name = "mbox-short.txt"
fhand = open(name)

#Empty hours dictionary
hours = {}
for lines in fhand:
lines = lines.lstrip()
#Looking for string matching a specific criteria
if lines.startswith('From '):
#Takes ecah line beginning with 'From'
#Removes all the white spaces and turns each line
#into a list of grouped characters
line = lines.split()
#print line[5]
#Stores the index location of the timesstamps found in every line
time_stamp = line[5]
#Stores all the timestamps without the colons
time_data=time_stamp.split(':')
#Stores the empty dictionary with
#the number of occurrences of each hour(index 0)
#if it already has a count for a given hour
#get() returns that hour, else get returns 0
#last increment each appearance by 1
hours[time_data[0]] = hours.get(time_data[0],0)+1

for key, value in sorted(hours.iteritems(), key=lambda (k,v): (v,k)):
print'Hrs: Counts: \n', "%s:\t %s" % (key, value)










51 changes: 51 additions & 0 deletions Assignments/Assignment_10.2_Derek_Afriyie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#Assignment10.4

"Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. "
"You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon."

"From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008"

"Once you have accumulated the counts for each hour, print out the counts, sorted by hour as shown below."


"Begin to write the program with the following code below:"
name = raw_input("Enter file:")
if len(name) < 1 :
name = "mbox-short.txt"
fhand = open(name)

#Empty hours dictionary
hours = {}
for lines in fhand:
lines = lines.lstrip()
#Looking for string matching a specific criteria
if lines.startswith('From '):
#Takes ecah line beginning with 'From'
#Removes all the white spaces and turns each line
#into a list of grouped characters
line = lines.split()
#print line[5]
#Stores the index location of the timesstamps found in every line
time_stamp = line[5]
#Stores all the timestamps without the colons
time_data=time_stamp.split(':')
#Stores the empty dictionary with
#the number of occurrences of each hour(index 0)
#if it already has a count for a given hour
#get() returns that hour, else get returns 0
#last increment each appearance by 1
hours[time_data[0]] = hours.get(time_data[0],0)+1
#Loops through hours dictionary & sort the keys & value by iterations
#key is set to lambda,anonymous function that reference the variables(k,v)
for key, value in sorted(hours.iteritems(), key=lambda (k,v): (v,k)):
print'Hrs: Counts: \n', "%s:\t %s" % (key, value)










Loading