information are uploaded
Joy and Beauty of Data, First Practicum – February 24, 2017
Name _______________________________________________________________
Question One. 25 points. Show a list with as few elements as possible where the median
function returns a different answer than the median_low function. Both functions are in the
statistics module.
Question Two. 25 points. Write a function named count_characters. The function receives a
list of strings. It should return the total number of characters contained in all strings.
For example, the following statement should print 20
print(count_characters([“You”, “may”, “say”, “I’m”, “a”, “dreamer”]))
Question Three. 25 points. Write a function named my_reverse. The function receives a list of
strings. It should return the list in reverse order without using the built-in reverse function.
For example, the following statement should print [‘dreamer’, ‘a’, “I’m”, ‘say’, ‘may’, ‘You’]
print(my_reverse([“You”, “may”, “say”, “I’m”, “a”, “dreamer”]))
Question Four. Complete the function below such that it creates a file that contains each
integer from 1 through n on successive lines of the output file.
For example, create_file(“jbd.txt”, 5) should create a file named “jbd.txt” that contains 1 on
the first line, 2 on the second line, 3 on the third line, 4 on the fourth line, and 5 on the fifth
line.
def create_file(file_name, n):
Lab 5: Review
Logistics
• Due: Tuesday, October 3rd no later than midnight.
• Partner Information: Complete this assignment individually.
• Submission Instructions: Upload your solution, named Your FirstName-YourLastName.py to the BrightSpace Lab 5 Dropbox.
• Deadline Reminder: Once this deadline passes, BrightSpace will no longer accept your Python submission and you will no longer be able to earn credit. Thus, if you are not able to fully
complete the assignment, submit whatever you have before the deadline so that partial credit can be earned.
Learning Outcomes
• This lab should help you prepare for Friday’s practicum by identify topics you understand well and topics you need to continue practicing.
Assignment
• Last Spring, a pilot offering of The Joy and Beauty of Data was offered at Bozeman High School. Answer each question on the practicum that was given at BHS.
Grading – 10 points
• 3 points – Question 1 has an answer.
2 points – Question 2 has an answer.
• 3 points – Question 3 has an answer.
• 2 points – Question 4 has an answer.
Grading note: You will receive full credit for submitting any reasonable answer. Sample solutions to each question will be covered in lecture on October 4th.
If Time Remains
• Work on Program 2, which is also due tonight at midnight, seeking feedback from your lab assistant if desired.