You accomplished all core and extra goals. Great job!
✓
accomplished
Procedure Requirements
Code checks which require that your code is written in a certain way, regardless of what happens when it runs (e.g., how many lines of code call a certain function).
Accomplished all core and extra procedure goals.
✓
accomplished
Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
Accomplished all 4 goals.
✓
accomplished
Define indentMessage
Use def to define indentMessage
Expected exactly 1 definition of indentMessage, found 1.
✓
accomplished
Call len(<any arguments>)
Within the definition of indentMessage, call len(<any arguments>) in exactly one place.
Expected exactly 1 call to len(<any arguments>), found 1.
✓
accomplished
Define printMessage
Use def to define printMessage
Expected exactly 1 definition of printMessage, found 1.
✓
accomplished
Call print(<any arguments>)
Within the definition of printMessage, call print(<any arguments>) in at least once place.
Expected at least 1 call to print(<any arguments>), found 1.
✓
accomplished
Call indentMessage(<any arguments>)
Within the definition of printMessage, call indentMessage(<any arguments>) in at least once place.
Expected at least 1 call to indentMessage(<any arguments>), found 1.
✓
accomplished
Define ellipseArea
Use def to define ellipseArea
Expected exactly 1 definition of ellipseArea, found 1.
✓
accomplished
Use a return statement
Within the definition of ellipseArea, use return _ in at least once place.
Expected at least 1 return statement, found 2.
✓
accomplished
Define polygon
Use def to define polygon
Expected exactly 1 definition of polygon, found 1.
✓
accomplished
Use a loop
Within the definition of polygon, use a for or while loop in at least once place.
Expected at least 1 loop, found 1.
✓
accomplished
Call fd(<any arguments>)
Within the loop within the definition of polygon, call fd(<any arguments>) or forward(<any arguments>) in at least once place.
Expected at least 1 call to fd(<any arguments>), found 1.
✓
accomplished
Process Requirements
Process checks which check how your code works by recording each operation that happens in order (e.g., how many times or with what arguments a certain function is called).
Accomplished all core and extra process goals.
✓
accomplished
Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
Accomplished all 2 goals.
✓
accomplished
The polygon function must maintain invariants for the position and heading values
Each call to the polygon function must return the position and heading values to their initial state before it returns.
all 1 calls to the polygon function maintained invariants for the position and heading values
✓
accomplished
The polygon function must maintain invariants for the position and heading values
Each call to the polygon function must return the position and heading values to their initial state before it returns.
all 1 calls to the polygon function maintained invariants for the position and heading values
✓
accomplished
Extra goals
Complete all extra goals in addition to the core goals for a perfect score.
Accomplished all 2 goals.
✓
accomplished
The polygon function must maintain invariants for the position and heading values
Each call to the polygon function must return the position and heading values to their initial state before it returns.
all 1 calls to the polygon function maintained invariants for the position and heading values
✓
accomplished
The polygon function must maintain invariants for the position and heading values
Each call to the polygon function must return the position and heading values to their initial state before it returns.
all 1 calls to the polygon function maintained invariants for the position and heading values
✓
accomplished
Product Requirements
Result tests that run your code and check for the internal result values it produces (e.g., the return value from a specific function).
Accomplished all core and extra product goals.
✓
accomplished
Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
Accomplished all 2 goals.
✓
accomplishedindentMessage returns the correct result
The result returned when your indentMessage function is run must match the solution result.
accomplished (in 2 contexts)
Accomplished in 2 contexts:
In context
The result of indentMessage
We ran your indentMessage function and compared the return value against the solution result. We ran your function with the following arguments:
'hello'
10
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
✓
Actual value is the same as the reference value.
' hello'
In context
The result of indentMessage
We ran your indentMessage function and compared the return value against the solution result. We ran your function with the following arguments:
'hi'
12
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
✓
Actual value is the same as the reference value.
' hi'
✓
accomplishedellipseArea returns the correct result
The result returned when your ellipseArea function is run must match the solution result.
accomplished (in 3 contexts)
Accomplished in 3 contexts:
In context
The result of ellipseArea
We ran your ellipseArea function and compared the return value against the solution result. We ran your function with the following arguments:
5
5
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
✓
Value 78.53981633974483 matches expected value to the required precision.
In context
The result of ellipseArea
We ran your ellipseArea function and compared the return value against the solution result. We ran your function with the following arguments:
5
10
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
✓
Value 157.07963267948966 matches expected value to the required precision.
In context
The result of ellipseArea
We ran your ellipseArea function and compared the return value against the solution result. We ran your function with the following arguments:
12.6
7.3
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
✓
Value 288.9636922771891 matches expected value to the required precision.
✓
accomplished
Extra goals
Complete all extra goals in addition to the core goals for a perfect score.
Accomplished all 1 goal.
✓
accomplishedindentMessage returns the correct result
The result returned when your indentMessage function is run must match the solution result.
Actual value is the same as the reference value.
'longword'
✓
accomplished
Behavior Requirements
Behavior tests that run your code and check what inputs it requests from and what outputs it displays to the user (e.g., what is printed given certain typed inputs).
Accomplished all core and extra behavior goals.
✓
accomplished
Core goals
Complete all core goals for core credit. Get partial credit for completing at least half, and more partial credit for completing at least 90%.
Accomplished all 2 goals.
✓
accomplishedprintMessage prints the correct output
The output printed when your printMessage function is run must match the solution output.
accomplished (in 2 contexts)
Accomplished in 2 contexts:
In context
The result of printMessage
We ran your printMessage function and compared the return value against the solution result. We ran your function with the following arguments:
'hello'
10
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
Printed output will be recorded.
✓
Strings are the same. Value tested
hello
In context
The result of printMessage
We ran your printMessage function and compared the return value against the solution result. We ran your function with the following arguments:
'hi'
12
We tested your submission.
Testing details:
Will be terminated if it takes longer than 5s.
Printed output will be recorded.
✓
Strings are the same. Value tested
hi
✓
accomplishedprintMessage uses correct indentation
We checked whether printMessage included the correct number of spaces before the message itself.
accomplished (in 2 contexts)
Accomplished in 2 contexts:
In context
The indentation of the output
We searched through the output for the indentation.
✓
Actual value is the same as the reference value.
' '
In context
The indentation of the output
We searched through the output for the indentation.
✓
Actual value is the same as the reference value.
' '
✓
accomplished
Extra goals
Complete all extra goals in addition to the core goals for a perfect score.
Accomplished all 1 goal.
✓
accomplishedprintMessage prints the correct output
The output printed when your printMessage function is run must match the solution output.
Actual value is the same as the reference value.
'longword\n'
Your code
Test results
File 'functions.py'
We will evaluate your submitted file 'functions.py'.
Evaluating 'functions.py'
Code in the target file
We parsed the code in the target file and paidattention to how it was written.
The code for 'functions.py' (shown elsewhere).
The values defined by the code.
We will run your code and so that we can run tests on the values it defines.
The following values were defined in the file:
Pen
RawPen
RawTurtle
Screen
ScrolledCanvas
Shape
Terminator
Turtle
TurtleScreen
Vec2D
addshape
back
backward
begin_fill
begin_poly
bgcolor
bgpic
bk
bye
circle
clear
clearscreen
clearstamp
clearstamps
clone
color
colormode
degrees
delay
distance
done
dot
down
ellipseArea
end_fill
end_poly
exitonclick
fd
fillcolor
filling
forward
get_poly
get_shapepoly
getcanvas
getpen
getscreen
getshapes
getturtle
goto
heading
hideturtle
home
ht
indentMessage
isdown
isvisible
left
listen
lt
mainloop
math
mode
numinput
onclick
ondrag
onkey
onkeypress
onkeyrelease
onrelease
onscreenclick
ontimer
pd
pen
pencolor
pendown
pensize
penup
polygon
pos
position
printMessage
pu
radians
register_shape
reset
resetscreen
resizemode
right
rt
screensize
seth
setheading
setpos
setposition
settiltangle
setundobuffer
setup
setworldcoordinates
setx
sety
shape
shapesize
shapetransform
shearfactor
showturtle
speed
st
stamp
textinput
tilt
tiltangle
title
towards
tracer
turtles
turtlesize
undo
undobufferentries
up
update
width
window_height
window_width
write
write_docstringdict
xcor
ycor
The result of indentMessage
We ran your indentMessage function and compared the return value against the solution result. We ran your function with the following arguments:
"""
functions.py
Your name: Peter Mawhorter
Your username: pmwh
Submission date: 2021-6-22
A few functions to practice with.
"""
def indentMessage(message, targetLength):
"""
Returns a string that's at least the given target length. If given a
longer string, it returns it as-is, but if given a shorter string, it
adds spaces to the front of the string to make it the required
length.
"""
indent = max(0, targetLength - len(message))
return ' ' * indent + message
def printMessage(message, width):
"""
Prints a message, taking up at least the required width (will be
wider if the message itself is wider). Uses indentMessage.
"""
print(indentMessage(message, width))
import math
def ellipseArea(radius1, radius2):
"""
Computes the area of an ellipse with the given radii (you may specify
the major and minor radii in either order). Returns the result as a
floating-point number.
"""
return radius1 * radius2 * math.pi
from turtle import *
def polygon(sideLength, nSides):
"""
Draws a polygon with the given side length and number of sides.
"""
for i in range(nSides):
fd(sideLength)
lt(360 / nSides)
source
"""
functions.py
Your name: Peter Mawhorter
Your username: pmwh
Submission date: 2021-6-22
A few functions to practice with.
"""
def indentMessage(message, targetLength):
"""
Returns a string that's at least the given target length. If given a
longer string, it returns it as-is, but if given a shorter string, it
adds spaces to the front of the string to make it the required
length.
"""
indent = max(0, targetLength - len(message))
return ' ' * indent + message
def printMessage(message, width):
"""
Prints a message, taking up at least the required width (will be
wider if the message itself is wider). Uses indentMessage.
"""
print(indentMessage(message, width))
import math
def ellipseArea(radius1, radius2):
"""
Computes the area of an ellipse with the given radii (you may specify
the major and minor radii in either order). Returns the result as a
floating-point number.
"""
return radius1 * radius2 * math.pi
from turtle import *
def polygon(sideLength, nSides):
"""
Draws a polygon with the given side length and number of sides.
"""
for i in range(nSides):
fd(sideLength)
lt(360 / nSides)
scope
<_ast.Module object at 0x1081bdfd0>
top_scope
<_ast.Module object at 0x1081bdfd0>
parse_errors
[]
module
value
null
output
ref_value
null
ref_output
The result of printMessage
We ran your printMessage function and compared the return value against the solution result. We ran your function with the following arguments:
"""
functions.py
Your name: Peter Mawhorter
Your username: pmwh
Submission date: 2021-6-22
A few functions to practice with.
"""
def indentMessage(message, targetLength):
"""
Returns a string that's at least the given target length. If given a
longer string, it returns it as-is, but if given a shorter string, it
adds spaces to the front of the string to make it the required
length.
"""
indent = max(0, targetLength - len(message))
return ' ' * indent + message
def printMessage(message, width):
"""
Prints a message, taking up at least the required width (will be
wider if the message itself is wider). Uses indentMessage.
"""
print(indentMessage(message, width))
import math
def ellipseArea(radius1, radius2):
"""
Computes the area of an ellipse with the given radii (you may specify
the major and minor radii in either order). Returns the result as a
floating-point number.
"""
return radius1 * radius2 * math.pi
from turtle import *
def polygon(sideLength, nSides):
"""
Draws a polygon with the given side length and number of sides.
"""
for i in range(nSides):
fd(sideLength)
lt(360 / nSides)
source
"""
functions.py
Your name: Peter Mawhorter
Your username: pmwh
Submission date: 2021-6-22
A few functions to practice with.
"""
def indentMessage(message, targetLength):
"""
Returns a string that's at least the given target length. If given a
longer string, it returns it as-is, but if given a shorter string, it
adds spaces to the front of the string to make it the required
length.
"""
indent = max(0, targetLength - len(message))
return ' ' * indent + message
def printMessage(message, width):
"""
Prints a message, taking up at least the required width (will be
wider if the message itself is wider). Uses indentMessage.
"""
print(indentMessage(message, width))
import math
def ellipseArea(radius1, radius2):
"""
Computes the area of an ellipse with the given radii (you may specify
the major and minor radii in either order). Returns the result as a
floating-point number.
"""
return radius1 * radius2 * math.pi
from turtle import *
def polygon(sideLength, nSides):
"""
Draws a polygon with the given side length and number of sides.
"""
for i in range(nSides):
fd(sideLength)
lt(360 / nSides)
scope
<_ast.Module object at 0x1081bdfd0>
top_scope
<_ast.Module object at 0x1081bdfd0>
parse_errors
[]
module
value
null
output
ref_value
null
ref_output
The result of printMessage
We ran your printMessage function and compared the return value against the solution result. We ran your function with the following arguments: