Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3dcc86e
first_assignment
TunisiaM Mar 29, 2016
e75d341
first_assignment
TunisiaM Mar 29, 2016
c43d3b1
first assignment
TunisiaM Mar 29, 2016
36ce4b2
new_version
TunisiaM Mar 29, 2016
cceb3df
Create Assignment_1
TunisiaM Mar 29, 2016
25e6805
slides
TunisiaM Mar 29, 2016
d874df1
slides_quarter_one
TunisiaM Mar 29, 2016
3f754ac
Merge branch 'master' of https://github.com/The-Knowledge-House/python01
TunisiaM Mar 29, 2016
f717c3d
slide_folder
TunisiaM Mar 29, 2016
895857e
slides_quarterone
TunisiaM Mar 29, 2016
b6ac08b
assignment2
TunisiaM Mar 31, 2016
0847a1e
assignment2
TunisiaM Mar 31, 2016
3b44d70
addtogithub
TunisiaM Mar 31, 2016
7297f4a
adding_files
TunisiaM Apr 5, 2016
b9fcf3f
slides
TunisiaM Apr 5, 2016
46c31ee
Create Assignment_3.1
TunisiaM Apr 5, 2016
504e9e0
Create Assignment_3.3
TunisiaM Apr 5, 2016
8a2c782
Update Assignment_3.1
TunisiaM Apr 5, 2016
be8d145
Update Assignment_3.3
TunisiaM Apr 5, 2016
d973dd4
Create Assignment_4.6
TunisiaM Apr 6, 2016
f28058d
slides for class 5
TunisiaM Apr 6, 2016
28b8d6a
slides for class 6
TunisiaM Apr 6, 2016
559878c
slides for the 14th of April
TunisiaM Apr 7, 2016
4bead52
Create Assignment_5.2
TunisiaM Apr 14, 2016
5d73811
Create Assignment_6.5
TunisiaM Apr 14, 2016
fce5383
slides 7 and 8
TunisiaM Apr 14, 2016
3e12617
Merge branch 'master' of https://github.com/The-Knowledge-House/python01
TunisiaM Apr 14, 2016
8064abd
extra slides push
TunisiaM Apr 14, 2016
d7ff99e
Create Assignment_7.1
TunisiaM Apr 14, 2016
4834eeb
Create Assignment_7.3
TunisiaM Apr 14, 2016
5517670
Create Assignment_8.4
TunisiaM Apr 21, 2016
28dd4cd
Create Assignment_8.5
TunisiaM Apr 21, 2016
c058768
Assignment
TunisiaM Apr 25, 2016
d692ceb
Assignment_9.4
TunisiaM Apr 25, 2016
02282b7
Assignment_10.2
TunisiaM Apr 25, 2016
cf00756
slides for May
TunisiaM Apr 25, 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
8 changes: 8 additions & 0 deletions Assignments/Assignment_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Hello Fellows!

Please write a program that uses a print statement to say “hello world” as shown below.
After writing the program, “hello world” should appear in your terminal.
Please take a screenshot of your terminal and push up the screenshot to your GitHub repository of this course
with the title of the screenshot being “Assignment 1: Hello World”.\

Thank you!
18 changes: 18 additions & 0 deletions Assignments/Assignment_10.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Hello Fellows,

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"
handle = open(name)


Happy Coding,
Tunisia
21 changes: 21 additions & 0 deletions Assignments/Assignment_3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Hello Fellows!

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)



Happy Coding,
Tunisia


In courtesy of Coursera.
23 changes: 23 additions & 0 deletions Assignments/Assignment_3.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Hello Fellows!

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 = raw_input("Enter Score: ")


Happy Coding,
Tunisia


In courtesy of Coursera.
22 changes: 22 additions & 0 deletions Assignments/Assignment_4.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Hello Fellows!

Write a program to prompt the user for hours and rate per hour using raw_input to compute gross pay.
Award time-and-a-half for the hourly rate for all hours worked above 40 hours.
Put the logic to do the computation of time-and-a-half in a function called computepay() and use the function to do the computation.
The function should return a value. 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 unless you want to - you can assume the user types numbers properly.
Do not name your variable sum or use the sum() function.

Begin writing the program with the code below:
def computepay(h,r):
return 42.37

hrs = raw_input("Enter Hours:")
p = computepay(10,20)
print "Pay",p



Happy Coding,
Tunisia
21 changes: 21 additions & 0 deletions Assignments/Assignment_5.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Hello Fellows!

Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'.
Once 'done' is entered, print out the largest and smallest of the numbers.
If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number.


Begin writing the program with the code below:
largest = None
smallest = None
while True:
num = raw_input("Enter a number: ")
if num == "done" : break
print num

print "Maximum", largest



Happy Coding,
Tunisia
12 changes: 12 additions & 0 deletions Assignments/Assignment_6.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Hello Fellows!

Write code using find() and string slicing (see section 6.10) to extract the number at the end of the line below.
Convert the extracted value to a floating point number and print it out.

Please use the line below:
text = "X-DSPAM-Confidence: 0.8475";



Happy Coding,
Tunisia
46 changes: 46 additions & 0 deletions Assignments/Assignment_7.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Hello Fellows!

Write a program that prompts for a file name, then opens that file and reads through the file,
and print the contents of the file in upper case.
Use the file words.txt to produce the output below.

You can download the sample data at http://www.pythonlearn.com/code/words.txt

Begin to write the program with the following code below:
# Use words.txt as the file name
fname = raw_input("Enter file name: ")
fh = open(fname)



Happy Coding,
Tunisia

P.S. The link: http://www.pythonlearn.com/code/words.txt, contains the following words:
WRITING PROGRAMS OR PROGRAMMING IS A VERY CREATIVE
AND REWARDING ACTIVITY YOU CAN WRITE PROGRAMS FOR
MANY REASONS RANGING FROM MAKING YOUR LIVING TO SOLVING
A DIFFICULT DATA ANALYSIS PROBLEM TO HAVING FUN TO HELPING
SOMEONE ELSE SOLVE A PROBLEM THIS BOOK ASSUMES THAT
{\EM EVERYONE} NEEDS TO KNOW HOW TO PROGRAM AND THAT ONCE
YOU KNOW HOW TO PROGRAM, YOU WILL FIGURE OUT WHAT YOU WANT
TO DO WITH YOUR NEWFOUND SKILLS

WE ARE SURROUNDED IN OUR DAILY LIVES WITH COMPUTERS RANGING
FROM LAPTOPS TO CELL PHONES WE CAN THINK OF THESE COMPUTERS
AS OUR PERSONAL ASSISTANTS WHO CAN TAKE CARE OF MANY THINGS
ON OUR BEHALF THE HARDWARE IN OUR CURRENT-DAY COMPUTERS
IS ESSENTIALLY BUILT TO CONTINUOUSLY AS US THE QUESTION
WHAT WOULD YOU LIKE ME TO DO NEXT

OUR COMPUTERS ARE FAST AND HAVE VASTS AMOUNTS OF MEMORY AND
COULD BE VERY HELPFUL TO US IF WE ONLY KNEW THE LANGUAGE TO
SPEAK TO EXPLAIN TO THE COMPUTER WHAT WE WOULD LIKE IT TO
DO NEXT IF WE KNEW THIS LANGUAGE WE COULD TELL THE
COMPUTER TO DO TASKS ON OUR BEHALF THAT WERE REPTITIVE
INTERESTINGLY, THE KINDS OF THINGS COMPUTERS CAN DO BEST
ARE OFTEN THE KINDS OF THINGS THAT WE HUMANS FIND BORING
AND MIND-NUMBING



16 changes: 16 additions & 0 deletions Assignments/Assignment_7.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Hello Fellows!

Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form:
X-DSPAM-Confidence: 0.8475

Count these lines and extract the floating point values from each of the lines and compute
the average of those values and produce an output as shown below.
Do not use the sum() function or a variable named sum in your solution.

You can download the sample data at http://www.pythonlearn.com/code/mbox-short.txt
when you are testing below enter mbox-short.txt as the file name.



Happy Coding,
Tunisia
20 changes: 20 additions & 0 deletions Assignments/Assignment_8.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Hello Fellows!

Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() method.
The program should build a list of words.
For each word on each line check to see if the word is already in the list and if not append it to the list.
When the program completes, sort and print the resulting words in alphabetical order.

You can download the sample data at http://www.pythonlearn.com/code/romeo.txt


Begin to write the program with the following code below:
fname = raw_input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
print line.rstrip()


Happy Coding!
Tunisia
24 changes: 24 additions & 0 deletions Assignments/Assignment_8.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Hello Fellows!

Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line:
From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008

You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person
who sent the message). Then print out a count at the end.
Hint: make sure not to include the lines that start with 'From:'.

You can download the sample data at http://www.pythonlearn.com/code/mbox-short.txt


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

fh = open(fname)
count = 0

print "There were", count, "lines in the file with From as the first word"


Happy Coding!
Tunisia
16 changes: 16 additions & 0 deletions Assignments/Assignment_9.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Hello Fellows!

Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages.
The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail.
The program creates a Python dictionary that maps the sender's mail address to a count of the number of times they appear in the file.
After the dictionary is produced, the program reads through the dictionary using a maximum loop to find the most prolific committer.

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



Happy Coding,
Tunisia
Binary file not shown.
6 changes: 6 additions & 0 deletions Resources/Class3_03-29-16/Assignment2_Tunisia_Mitchell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Hello Class,

An example of how to upload an assignment.

Happy Coding,
Tunisia Mitchell
Binary file added Slides/03-24,29-16-Intro.pdf
Binary file not shown.
Binary file added Slides/03-29-16-Expressions.pdf
Binary file not shown.
Binary file added Slides/04-05-16-Conditional.pdf
Binary file not shown.
Binary file added Slides/04-07-16-Functions.pdf
Binary file not shown.
Binary file added Slides/04-12-16-Iterations.pdf
Binary file not shown.
Binary file added Slides/04-14-16-Strings.pdf
Binary file not shown.
Binary file added Slides/04-19-16-Files.pdf
Binary file not shown.
Binary file added Slides/04-21-16-Lists.pdf
Binary file not shown.
Binary file added Slides/04-26-16-Dictionaries.pdf
Binary file not shown.
Binary file added Slides/04-28-16-Tuples.pdf
Binary file not shown.
Binary file added Slides/05-02-16-Regex.pdf
Binary file not shown.
Binary file added Slides/05-04-16-HTTP.pdf
Binary file not shown.