Python - Michael Finnegan Assignment
- Due Oct 16, 2016 by 11:59pm
- Points 10
- Submitting a text entry box or a file upload
- File Types pdf
Questions? Assignment Discussion: Python - Michael Finnegan Assignment
The files for this assignment should be in:
~/assign/assign1/
Remember that ~ (tilde character) means your home folder. You can always get there by typing
cd ~
1. Using your text editor, create a file called "lastname_firstname_q1.txt" (e.g., for me it would be named howison_james_q1.txt). Ensure that it only has the file extension ".txt" and not ".txt.txt" or some other ending. In this file put this text:
There once was a man named Michael Finnegan,
He had whiskers on his chinnegan,
The wind came up and blew them in ag'in,
Poor old Michael Finnegan (begin ag'in)
Note that the file should end with a newline character and the last line of the file should be empty.
2. Save your q1 file as "lastname_firstname_q2.py". In this file print out the poem using python, so that when we run the file with "python lastname_firstname_q2.py" the poem is output to the console. This requires putting the poem into a single string, then outputting that string. Outputting new lines is optional.
3. Save your q1 file as "lastname_firstname_q3.py". This time split the poem into four strings, one for each line.
4. Save your q3 file as "lastname_firstname_q4.py". In this file we will print out the poem, but we will be able to replace the name "Michael Finnegan" with whatever we put into a variable. At the start of the file define a variable called name and put a string for your name into it. Yes, your personal name. Split the strings up so that you can use the name variable wherever "Michael Finnegan" was. Yes, this will most likely ruin the rhyme!
5. Save your q4 file as "lastname_firstname_q5.py". Revise the code to take input and use it instead of defining the name variable in the file.
The next question require you to learn on your own; we haven't covered these in class. For each I've provided the appropriate search terms.
6. Revise q4 to use the str.format() function. Save the files as "lastname_firstname_q6.py".
Questions 7-10 require written answers, submitted in a PDF to this assignment.
7. In Q1, describe what happens to get your .txt file onto the server. You should describe both what you did and what happens in the software to get your file up there.
8. In Q2, describe how the text appears on the screen. Use the word "interpreter" somewhere :)
9. In Q4, describe what happens in the code.
10. For Q6 you had to look up and read about new techniques in python. Describe your process of learning. For example, describe what you did and which resources you read. What did you understand initially and what didn't you understand. What did you try? How did your understanding improve? If you were reading a forum, did the questions that others asked help you? (Note that you can't get this question wrong, even if you never figured out how to answer Q6 you can still get points for Q10, just describe what you tried and what you didn't understand.). The answer for this question should be several paragraphs; you can include screenshots if you like.
Rubric
Criteria | Ratings | Pts | |||
---|---|---|---|---|---|
Q1
Does the file exist, and does it have the appropriate qualities?
threshold:
pts
|
|
pts
--
|
|||
Q2
When we run the appropriately named file, the poem is output to the console.
threshold:
pts
|
|
pts
--
|
|||
Q3
When the appropriately named python file is run, the poem appears. In the code, the poem is split into four strings.
threshold:
pts
|
|
pts
--
|
|||
Q4
When the python file is run, outputs a poem with the student's name in place of Michael Finnegan.
threshold:
pts
|
|
pts
--
|
|||
Q5
When the python file is run, it first takes input and then uses that input as the name to replace Michael Finnegan.
threshold:
pts
|
|
pts
--
|
|||
Q6
The code does the same thing as Q4 but with str.format() instead of whatever is used.
threshold:
pts
|
|
pts
--
|
|||
Q7
threshold:
pts
|
|
pts
--
|
|||
Q8
threshold:
pts
|
|
pts
--
|
|||
Q9
threshold:
pts
|
|
pts
--
|
|||
Q10
Response should be thorough and reference actual sources used.
threshold:
pts
|
|
pts
--
|
|||
Total Points:
10
out of 10
|