Part I due by 11:59 p.m. on Thursday, February 1, 2024
Part II due by 11:59 p.m. on Sunday, February 4, 2024
In your work on this assignment, make sure to abide by the collaboration policies of the course.
Using folders
We strongly encourage you to create a separate folder for each
assignment, so that you can more easily keep track of your
work. For example, you could create a folder called ps1
for your
work on this assignment, and put all of the files for PS 1 in
that folder.
If you have questions while working on this assignment, please
come to office hours, post them on Piazza, or email
cs111-staff@cs.bu.edu
.
Make sure to submit your work on Gradescope, following the procedures found at the end of Part I and Part II.
If you haven’t already created a folder named cs111
for your
work in this course, follow these
instructions to do so.
Then create a subfolder called ps1
within your cs111
folder,
and put all of the files for this assignment in that folder.
Problems 0 and 1 will both be completed in a single PDF file. To create it, you should do the following:
Access the template that we have created by clicking on this link and signing into your Google account as needed.
When asked, click on the Make a copy button, which will save a copy of the template file to your Google Drive.
Select File->Rename, and change the name of the file to
ps1pr01
.
Add your work for Problems 0 and 1 to this file.
Once you have completed these problems, choose
File->Download->PDF document, and save the PDF file in your ps1
folder. The resulting PDF file (ps1pr01.pdf
) is the one that you
will submit. See the submission guidelines at the end of Part I.
5 points; individual-only
In class, we’ve been exploring various types of data in Python. As you’ve probably heard, we’re currently living in the age of big data, in which massive amounts of data are being collected, analyzed, and used to guide decisions in a wide range of occupations and fields of study. This week’s reading, which comes from Wired, discusses the ways in which data is affecting science.
The reading is available here.
(If you can’t access that page, you can find a PDF version of the article here.)
After you have read the article, write a response that addresses only one of the following prompts.
Important: Put your response in the copy of the ps1pr01
template that you created on Google Drive (see above).
The author refers to one’s “MySpace” page. This is a clear, if superficial, way in which this article (which was written in 2008) shows its age. What is a deeper way in which the ideas of this article betray thinking that has moved on since 2008? Contrast one of its ideas with more recent thinking, which can be your own, others’, or both.
The article states that, whether in science or business, we “don’t have to settle for models at all.” Do you agree or disagree with this statement? How? And why? Certainly feel free to articulate a more nuanced or hybrid view, if you’d like.
You only need to write a short paragraph (4-6 sentences). The important thing is that your response uses and extends (or alters or refutes) ideas from the article.
15 points; individual-only
Assume that you have two variables x
and y
that have
each been assigned an integer value. Construct the boolean
expressions specified below.
Note: You should not include an if
statement; you
simply need to provide the necessary boolean expression. Sample
boolean expressions include:
x < y
x == y + 3
Here are your tasks:
Write a boolean expression that tests if a
is not equal to two more
than three times the value of b
.
Write a boolean expression that tests if a
is a multiple of 3.
%
) can be used
to find the remainder of a division. For example,
10 % 2
is 0
because 2
divides evenly into 10
.Write a boolean expression that tests if b
is outside the set
of integers from 6 to 16 inclusive. Your expression should use
one of the logical operators (and
, or
, or not
).
Consider the following Python program:
def mystery(vals): a = vals[0] b = vals[1] c = vals[2] if a < b: if b > c: print('wow') else: print('tow') elif b >= c: if a >= c: print('mow') elif b < a: print('low') if c == a: print('dow') elif a == b: print('now') if b < c: print('how') else: print('bow') print('row')
In the table that we have provided in section 1-2 of ps1pr01
,
add the output that would result from each of the following
function calls:
mystery([3, 3, 3])
mystery([3, 4, 5])
mystery([5, 3, 2])
mystery([5, 5, 7])
mystery([6, 4, 6])
mystery([2, 4, 1])
If needed, feel free to expand the space provided for each call’s output.
Note: You can check your answers by copying the program into a new editor file in Spyder and running it. However, make sure that you understand why you end up with the outputs that you do!
Once you have completed Problems 0 and 1, choose File->Download->PDF
document, and save the PDF file in your ps1
folder. The
resulting PDF file (ps1pr01.pdf
) is the one that you will
submit. See the submission guidelines at the end of Part I.
15 points; individual-only
This problem will give you practice with indexing and slicing.
Getting started
If you haven’t already done so, create a folder named ps1
for your work on this assignment. You can find instructions for
doing so here.
Download this file: ps1pr2.py
Make sure to put the file in your ps1
folder. If your browser
doesn’t allow you to specify where the file should be saved, try
right-clicking on the link above and choosing Save as... or
Save link as..., which should produce a dialog box that allows you
to choose the correct folder for the file.
Open the file in Spyder, following the procedure outlined in Task 2 of Lab 1.
If you haven’t already done so, you should make sure to configure Spyder as we have instructed.
List puzzles
The first half of the problem focuses on lists. In particular, you
will be constructing new lists from the following:
pi = [3, 1, 4, 1, 5, 9] e = [2, 7, 1]
We’ve given you these lines in ps1pr2.py
. In addition, we’ve provided
the answer to the first puzzle (puzzle 0). You should add in the
answers for the remaining puzzles, following the format that we’ve
given you for puzzle 0.
The expressions that you construct must only use
pi
and e
and the following list operations:
pi[0]
)e[1:]
or pi[2:4]
)pi[6:4:-1]
)pi[:1] + e[1:]
. Note that you may
not use +
to add values numerically.)[e[2]]
or [e[2], e[0]]
)You may also use parentheses if needed.
We encourage you to try using as few operations as possible, to keep your answers elegant and efficient. However, you will get full credit for any expression that follows the rules above and produces the correct result.
Before getting started, you should run ps1pr2.py
in Spyder using the
“play” icon or F5. This will make the lists pi
and e
available
to you in the IPython console.
Here are the puzzles:
Use pi
and/or e
to create the list [2, 5, 9]
, and assign it to
the variable answer0
. We’ve given you the code for this puzzle.
Use pi
and/or e
to create the list [2, 7]
and assign it to
the variable answer1
. Your answer should follow the format that we’ve
given you for problem 0. In other words, it should look like this:
# Puzzle 1: # Creating the list [2, 7] from pi and e answer1 =
where you put the appropriate expression to the right of the assignment
operator (=
). Please leave a blank line between puzzles to make
things more readable.
Use pi
and/or e
to create the list [5, 4, 3]
, and assign it to
the variable answer2
. Here again, make sure to follow the
correct format, and to leave a blank line between puzzles.
Use pi
and/or e
to create the list [1, 2, 3, 4, 5]
, and
assign it to the variable answer3
. (Optional challenge: See if
you can do this with just three list operations!)
String puzzles
The second half of the problem focuses on strings. In particular, you
will be working with the following strings:
b = 'boston' u = 'university' t = 'terriers'
We’ve given you these lines in ps1pr2.py
, along with the answer
to the first string puzzle (puzzle 4).
The expressions that you construct for the remaining puzzles must
only use b
, u
, t
and the following string operations:
b[0]
)u[1:]
or t[2:4]
)u[6:4:-1]
)b + u
)5*b
or 3*u[-1]
)You may also use parentheses if needed.
Here again, you will get full credit for any expression that follows the rules above and produces the correct result, but we encourage you to try using as few operations as possible.
Before getting started, you should run ps1pr2.py
in Spyder using
the “play” icon or F5. This will make the strings b
, u
, and t
available to you in the IPython console.
Here are the puzzles:
Use b
, u
, and/or t
to create the string 'bossy'
, and assign it
to the variable answer4
. We’ve given you the following code for
this puzzle:
# Example puzzle (puzzle 4) # Creating the string 'bossy' answer4 = b[:3] + t[-1] + u[-1]
Note that our answer involves 5 operations: 2 uses of indexing, 1 slice,
and 2 concatenations with +
. (It’s actually possible to solve this
puzzle using only 3 operations. Give it a try if you have time!)
Use b
, u
, and/or t
to create the string 'universe'
, and assign
it to the variable answer5
. (Our best answer uses 3 ops.) Here again,
make sure to follow the correct format, and to leave a blank line
between puzzles.
Use b
, u
, and/or t
to create the string 'roster'
, and
assign it to the variable answer6
. (Our best: 5 ops.)
Use b
, u
, and/or t
to create the string 'yesyesyes'
, and
assign it to the variable answer7
. (Our best: 4 ops.)
Use b
, u
, and/or t
to create the string 'trist'
, and
assign it to the variable answer8
. (Our best: 3 ops.)
After finishing all of the puzzles, make sure to run your
ps1pr2.py
file to check that the correct outputs are printed.
20 points; pair-optional
This is the only problem of the assignment that you may complete with a partner. See the rules for working with a partner on pair-optional problems for details about how this type of collaboration must be structured.
In this problem you will write a collection of simple functions that operate on numeric inputs.
Begin by downloading this file: ps1pr3.py
Make sure to put the file in your ps1
folder. If your browser
doesn’t allow you to specify where the file should be saved, try
right-clicking on the link above and choosing Save as... or
Save link as..., which should produce a dialog box that allows you
to choose the correct folder for the file.
Important guidelines:
You may find it helpful to review the example functions from lecture so you can use them as models for what you need to do.
Your functions must have the exact names that we have
specified, or we won’t be able to test them. Note in
particular that the case of the letters matters (all of them
should be lowercase), and that you should use an underscore
character (_
) wherever we have specified one (e.g., in
convert_to_inches
).
If a function takes more than one input, you must keep the inputs in the order that we have specified.
Each of your functions should include a docstring that describes what your function does and what its inputs are. See our example functions from lecture for models.
Make sure that your functions return the specified value,
rather than printing it. None of these functions should use a
print
statement.
You should not use any Python features that we have not discussed in lecture.
Unless otherwise stated, your functions do not need to handle bad inputs – inputs with a type or value that doesn’t correspond to the description of the inputs provided in the problem.
Test each function after you write it. Here are two ways to do so:
Run your ps1pr3.py
file after you finish a given function.
Doing so will display a message in the IPython console,
and you will then be able to use the console to call the
function using different inputs and check to see that you
obtain the correct outputs.
Optional: Add test calls to the test
function that we
have provided at the bottom of your ps1pr3.py
file. We
have given you an example of one such test call in the
starter file. After running your ps1pr3.py
file, you
can call the test
function (by entering test()
) to see
the results of all of the test calls.
To facilitate grading, please put any test code inside a
function like the test
function that we have given you.
Do not add any lines of code that
belong to the global scope of the program (i.e., lines that are
outside of any function).
Open your ps1pr3.py
file in Spyder, and add to it your implementations
of following functions:
(example) Write a function opposite(x)
that takes a
number x
as its input and returns the opposite of its input.
We have given you this example function in the starter file.
Write a function cube(x)
that takes a number x
as its input
and returns the cube of its input (i.e., x
raised to the
power of 3). For example:
>>> cube(2) result: 8 >>> cube(-5) result: -125
Hint: You can use the **
operator in your solution.
Important
Make sure that your function returns the correct
value rather than printing it. If your function is
printing the return value, you won’t see an output prompt
(the result:
prompt above) before the return values. If
you don’t see that prompt, you must fix your
function so that it uses a return
statement rather than
a print
statement. This same warning applies to
all of the functions that you will write for this
assignment, with the exception of the optional test
functions that you may include for testing your code.
You should leave one or two blank lines between functions to make things more readable, and make sure to include a docstring like the one in our example function.
Make sure that you use the correct amount of indentation. In
particular, your docstrings should be indented by 4 spaces as shown
in our code for opposite
, so that they line up with the code
inside the function.
Write a function convert_to_inches(yards, feet)
that takes two
numeric inputs yards
and feet
that together represent a single
length broken up into yards and feet, and that returns the
corresponding length in inches.
For example:
>>> convert_to_inches(4, 2) # 4 yards + 2 feet = 168 inches result: 168 >>> convert_to_inches(1, 1) # 1 yard + 1 foot = 48 inches result: 48
If either input is negative, it should be replaced with a 0 in your computation. For example:
>>> convert_to_inches(-4, 2) # replace -4 with 0, 2 feet = 24 inches result: 24 >>> convert_to_inches(3, -5) # replace -5 with 0, 3 yards = 108 inches result: 108
Hints:
1 foot is 12 inches, and 1 yard is 3 feet or 36 inches.
You should use conditional execution to handle cases in which an input is less than 0.
Write a function area_sq_inches(height_yds, height_ft, width_yds,
width_ft)
that takes four numeric inputs:
height_yds
and height_ft
that together represent the height
of a rectanglewidth_yds
and width_ft
that together represent the width
of a rectangleBased on these inputs, the function should return the area of the rectangle in square inches. In other words, it should:
Examples:
>>> area_sq_inches(1, 2, 3, 1) # (1 yd, 2 ft) x (3 yds, 1 ft) = 7200 sq inches result: 7200 >>> area_sq_inches(2, 0, 1, 2) # (2 yds, 0 ft) x (1 yd, 2 ft) = 4320 sq inches result: 4320
Notes:
You must start by making two calls to the
convert_to_inches
function that you wrote earlier—one call
to compute the height in inches, and one call to compute the width
in inches–and store the results of those calls in variables.
Then you must use those variables to compute the area.
If any of the inputs are negative, they should be replaced
with a 0. However, because you are calling convert_to_inches
,
you can let that other function handle the replacements for
you!
Write a function median(a, b, c)
that takes three numeric inputs
a
, b
, and c
, and that returns the median of the three
inputs–i.e., the value that falls in the middle of the other two
when the three values are listed in increasing order. For example:
>>> median(10, 2, 7) # 7 is the middle value of 2, 7, 10 result: 7 >>> median(7, 2, 10) # 7 is still the middle value of 2, 7, 10 result: 7 >>> median(8, 6, 4) # 6 is the middle value of 4, 6, 8 result: 6
Your function must use conditional execution, and it must not use any of Python’s built-in functions. Your function should also work if two or more of the values are the same:
>>> median(10, 2, 2) # 2 is the middle value of 2, 2, 10 result: 2
Hint: Python makes it easy to test if one value is between two
other values. For example, to test if x
is in the interval [0, 10],
we could use this expression:
0 <= x <= 10
In writing your function, you could do something similar to see if the value of one variable is between the values of the other two.
Don’t forget to test your functions using the approaches mentioned at the start of the problem.
You may also find it helpful to use the
Python Tutor Visualizer to trace through the execution of your functions –
either to verify that they’re working as expected, or to determine why
they’re not working! Paste your function definition into the
Visualizer’s code box, and follow the definition with code that calls
the function. Then click the Visualize Execution button below the
code box to begin the visualization. For example, to test the
circle_area
function that we discussed in one of the
pre-lecture videos, you could paste the following into the Visualizer:
def circle_area(diam): radius = diam / 2 area = 3.14159 * (radius**2) return area test = circle_area(10) print('test is', test)
Login to Gradescope by clicking the link in the left-hand navigation bar, and click on the box for CS 111.
You will make submissions to two separate assignments on Gradescope. The steps needed for the two submissions are different, so please make sure to follow carefully the procedures outlined below.
PS 1: Problems 0 and 1
Submit your ps1pr01.pdf
file using these steps:
If you still need to create a PDF file, open your file
on Google Drive, choose File->Download->PDF document, and
save the PDF file in your ps1
folder.
Click on the name of the assignment (PS 1: Problems 0 and 1) in the list of assignments on Gradescope. You should see a pop-up window labeled Submit Assignment. (If you don’t see it, click the Submit or Resubmit button at the bottom of the page.)
Choose the Submit PDF option, and then click the Select PDF button and find the PDF file that you created. Then click the Upload PDF button.
You should see a question outline along with thumbnails of the pages from your uploaded PDF. For each question in the outline:
As you do so, click on the magnifying glass icon for each page and doublecheck that the pages that you see contain the work that you want us to grade.
Once you have assigned pages to all of the problems in the question outline, click the Submit button in the lower-right corner of the window. You should see a box saying that your submission was successful.
PS 1: Problems 2 and 3
Submit your ps1pr2.py
and ps1pr3.py
files using these steps:
Click on the name of the assignment (PS 1: Problems 2 and 3) in the list of assignments. You should see a pop-up window with a box labeled DRAG & DROP. (If you don’t see it, click the Submit or Resubmit button at the bottom of the page.)
Add both files to the box labeled DRAG & DROP. You can either drag and drop the files from their folder into the box, or you can click on the box itself and browse for the files.
Click the Upload button.
You should see a box saying that your submission was successful.
Click the (x)
button to close that box.
The Autograder will perform some tests on your files. Once it is done, check the results to ensure that the tests were passed. If one or more of the tests did not pass, the name of that test will be in red, and there should be a message describing the failure. Based on those messages, make any necessary changes. Feel free to ask a staff member for help.
Note: You will not see a complete Autograder score when you submit. That is because additional tests for at least some of the problems will be run later, after the final deadline for the submission has passed. For such problems, it is important to realize that passing all of the initial tests does not necessarily mean that you will ultimately get full credit on the problem. You should always run your own tests to convince yourself that the logic of your solutions is correct and that you have satisfied all of the stated requirements.
If needed, use the Resubmit button at the bottom of the page to resubmit your work. Important: Every time that you make a submission, you should submit all of the files for that Gradescope assignment, even if some of them have not changed since your last submission.
Near the top of the page, click on the box labeled Code. Then click on the name of each file to view its contents. Check to make sure that the files contain the code that you want us to grade.
Important
It is your responsibility to ensure that the correct version of every file is on Gradescope before the final deadline. We will not accept any file after the submission window for a given assignment has closed, so please check your submissions carefully using the steps outlined above.
If you are unable to access Gradescope and there is enough
time to do so, wait an hour or two and then try again. If you
are unable to submit and it is close to the deadline, email
your homework before the deadline to
cs111-staff@cs.bu.edu
10 points; individual-only
We will cover the material needed for this problem in Wednesday’s lecture.
Begin by creating the necessary file:
Access the template that we have created by clicking on this link and signing into your Google account as needed.
When asked, click on the Make a copy button, which will save a copy of the template file to your Google Drive.
Select File->Rename, and change the name of the file to
ps1pr4
.
Here are your tasks:
Consider the following Python program:
def foo(a, b): b = b - 2 a = a - b print('foo', a, b) return a a = 8 b = 6 print(a, b) a = foo(a, b) print(a, b) foo(b, a) print(a, b)
In section 4-1 of ps1pr4
, we have given you tables that can be
used to trace the execution of the program.
We have started the first and third tables for you. You should:
You may not need all of the rows provided in the tables.
Don’t forget that the global variables and local variables are two separate sets of variables, even though they happen to have the same names.
For an example of how to approach this problem, and of what your answer should look like, we encourage you to review the pre-lecture video called Tracing Function Calls that will be available on Blackboard in the lecture folder for 1/31.
Consider the following Python program:
def wow(a): b = a * 2 print('wow:', a, b) return b def yay(b): a = wow(b) + wow(b + 2) print('yay:', a, b) return a a = 1 b = 5 print(a, b) b = wow(b) print(a, b) yay(a) print(a, b)
In section 4-2 of ps1pr4
, we have given you tables that can be
used to trace the execution of the program.
We have started the first and fourth tables for you. You should:
You may not need all of the rows provided in the tables.
Once you have completed Problem 4, choose File->Download->PDF
document, and save the PDF file in your ps1
folder. The
resulting PDF file (ps1pr4.pdf
) is the one that you will
submit. See the submission guidelines at the end of Part II.
15 points; individual-only
In Spyder, open a new editor window using File -> New File,
and save it to your ps1
folder using the name ps1pr5.py
.
Include comments at the top of the file that are similar to the ones
that we gave you at the top of ps1pr3.py
.
Follow the same guidelines that we gave you for problem 3.
Write a function first_and_last(values)
that takes a list values
and
returns a new list containing the first value of the original
list followed by the last value of the original list.
You may assume that the original list has at least one value.
Although this function could be completed in one line, you must use the following template:
def first_and_last(values): """ put your docstring here """ first = ________ last = ________ return [first, last]
Here are some examples of how the function should work:
>>> first_and_last([1, 2, 3, 4]) result: [1, 4] >>> first_and_last([7]) # 7 is both first and last! result: [7, 7] >>> first_and_last(['how', 'are', 'you?']) result: ['how', 'you?']
Warning
Remember that your functions should return the correct
value rather than printing it. If your function is printing the
return value, you won’t see an output prompt (the result:
prompt above) before the return values. If you don’t see that
prompt, you must fix your function so that it uses a return
statement rather than a print
statement. This same warning
applies to all of the functions that you will write for
this assignment, with the exception of the optional test
functions that you may include for testing your code.
Write a function longer_len(s1, s2)
that takes as inputs two
string values s1
and s2
, and that returns the length of
the longer string. For example:
>>> longer_len('computer', 'compute') result: 8 >>> longer_len('hi', 'hello') result: 5 >>> longer_len('begin', 'on') result: 5
Your function must use conditional execution, and it
should not use Python’s built-in max
function.
You may use other built-in functions as needed.
Write a function move_to_end(s, n)
that takes as inputs a
string value s
and an integer n
, and that returns the a new
string in which the first n
characters of s
have been moved to the
end of the string. For example:
>>> move_to_end('computer', 3) # move 'com' after 'puter' result: 'putercom' >>> move_to_end('computer', 5) # move 'compu' after 'ter' result: 'tercompu' >>> move_to_end('computer', 0) result: 'computer'
Special case: If n
(the second input) is greater than or
equal to the length of s
(the first input), then the function
should simply return the original s
without changing it:
>>> move_to_end('hi', 5) # 5 > len('hi') result: 'hi'
Don’t forget to test your functions using the approaches mentioned at the start of Problem 3. You may also find it helpful to use Python Tutor Visualizer to trace through the execution of your functions, as described at the end of Problem 3.
20 points; individual-only
In Spyder, open a new editor window using File -> New File,
and save it to your ps1
folder using the name ps1pr6.py
.
Include comments at the top of the file that are similar to the ones
that we gave you at the top of ps1pr3.py
.
Follow the same guidelines that we gave you for problem 3.
Write a function mirror(s)
that takes as input a string s
and returns a mirrored version of s
that
is twice the length of the original string. For example:
>>> mirror('bacon') result: 'baconnocab' >>> mirror('XYZ') result: 'XYZZYX'
Hint: Use skip-slicing!
Write a function ends_match(s)
that takes a string input s
and
returns True
if the first character in s
matches the last character
in s
, and False
otherwise. It does not have to work on the empty
string (the string ''
, which has no characters – not even a space).
Here are some examples:
>>> ends_match('no match') # 'n' does not match 'h' result: False >>> ends_match('hah! a match') # 'h' matches 'h' result: True >>> ends_match('q') # 'q' is at both ends! result: True
Warning
Your function should return a boolean value – either True
or False
, without any quotes around them. If you see
quotes around the result when you make the calls above from
the console, you must fix your function to remove the
quotes.
Write a function replace_end(values, new_end_vals)
that takes as
inputs a list values
and another list new_end_vals
, and that
returns a new list in which the elements in new_end_vals
have replaced the last n
elements of the list values
,
where n
is the length of new_end_vals
. For example:
>>> replace_end([1, 2, 3, 4, 5], [7, 8, 9]) result: [1, 2, 7, 8, 9]
In the above example, the second input has a length of 3, so we
replace the last 3 elements of the first input (the elements [3,
4, 5]
) with the elements specified by the second input ([7, 8,
9]
).
Other examples:
>>> replace_end([1, 2, 3, 4, 5], [10, 11]) result: [1, 2, 3, 10, 11] >>> replace_end([1, 2, 3, 4, 5], [12]) result: [1, 2, 3, 4, 12]
Special case: If the length of the second input is greater than or equal to the length of the first input, then the function should simply return the original second input:
>>> replace_end([0, 2, 4, 6], [4, 3, 2, 1]) result: [4, 3, 2, 1] >>> replace_end([0, 2, 4, 6], [4, 3, 2, 1, 0]) result: [4, 3, 2, 1, 0]
Hint: Begin by computing the length of new_end_vals
and
storing it in an appropriately named variable. Then use that
variable in the rest of your code.
Write a function repeat_elem(values, index, num_times)
that
takes as inputs a list values
, an integer index
(which you may
assume is a valid index for one of the elements in values
), and
a positive integer num_times
, and that returns a new list
in which the element of values
at position index
has been
repeated num_times
times. For example:
>>> repeat_elem([10, 11, 12, 13], 2, 4) result: [10, 11, 12, 12, 12, 12, 13]
In the above example, the second input is 2
and the third input
is 4
, so we take the element at position 2 of the list (the
12
) and repeat it 4
times.
Other examples:
>>> repeat_elem([10, 11, 12, 13], 2, 6) # repeat element 2 six times result: [10, 11, 12, 12, 12, 12, 12, 12, 13] >>> repeat_elem([5, 6, 7], 1, 3) # repeat element 1 three times result: [5, 6, 6, 6, 7]
Don’t forget to test your functions using the approaches mentioned at the start of Problem 3. You may also find it helpful to use the Python Tutor Visualizer to trace through the execution of your functions, as described at the end of Problem 3.
Login to Gradescope by clicking the link in the left-hand navigation bar, and click on the box for CS 111.
You will make submissions to two separate assignments on Gradescope. The steps needed for the two submissions are different, so please make sure to follow carefully the procedures outlined below.
PS 1: Problem 4
Submit your ps1pr4.pdf
file using these steps:
If you still need to create a PDF file, open your file
on Google Drive, choose File->Download->PDF document, and
save the PDF file in your ps1
folder.
Click on the name of the assignment in the list of assignments on Gradescope. You should see a pop-up window labeled Submit Assignment. (If you don’t see it, click the Submit or Resubmit button at the bottom of the page.)
Choose the Submit PDF option, and then click the Select PDF button and find the PDF file that you created. Then click the Upload PDF button.
You should see a question outline along with thumbnails of the pages from your uploaded PDF. For each question in the outline:
As you do so, click on the magnifying glass icon for each page and doublecheck that the pages that you see contain the work that you want us to grade.
Once you have assigned pages to all of the questions in the question outline, click the Submit button in the lower-right corner of the window. You should see a box saying that your submission was successful.
If needed, use the Resubmit button at the bottom of the page to resubmit your work.
PS 1: Problems 5 and 6
Submit your ps1pr5.py
and ps1pr6.py
files using these steps:
Click on the name of the assignment in the list of assignments. You should see a pop-up window with a box labeled DRAG & DROP. (If you don’t see it, click the Submit or Resubmit button at the bottom of the page.)
Add both files to the box labeled DRAG & DROP. You can either drag and drop the files from their folder into the box, or you can click on the box itself and browse for the files.
Click the Upload button.
You should see a box saying that your submission was successful.
Click the (x)
button to close that box.
The Autograder will perform some tests on your files. Once it is done, check the results to ensure that the tests were passed. If one or more of the tests did not pass, the name of that test will be in red, and there should be a message describing the failure. Based on those messages, make any necessary changes. Feel free to ask a staff member for help.
Note: You will not see a complete Autograder score when you submit. That is because additional tests for at least some of the problems will be run later, after the final deadline for the submission has passed. For such problems, it is important to realize that passing all of the initial tests does not necessarily mean that you will ultimately get full credit on the problem. You should always run your own tests to convince yourself that the logic of your solutions is correct.
If needed, use the Resubmit button at the bottom of the page to resubmit your work. Important: Every time that you make a submission, you should submit all of the files for that Gradescope assignment, even if some of them have not changed since your last submission.
Near the top of the page, click on the box labeled Code. Then click on the name of each file to view its contents. Check to make sure that the files contain the code that you want us to grade.
Important
It is your responsibility to ensure that the correct version of every file is on Gradescope before the final deadline. We will not accept any file after the submission window for a given assignment has closed, so please check your submissions carefully using the steps outlined above.
If you are unable to access Gradescope and there is enough
time to do so, wait an hour or two and then try again. If you
are unable to submit and it is close to the deadline, email
your homework before the deadline to
cs111-staff@cs.bu.edu
Last updated on January 31, 2024.