JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Solution Debug 4.3. Total Points
Share
Explore
Gallery
Solution Debug 4.3. Total Points
Solution Debug 4.3. Total Points
Solution
The Task
Python Starter Code
CodeClips
Solution
At the right hand side is the
the task, starter code and code clips
that pupils got.
Below is a link to the solution. You can right click
open on replit
to demo the answer to pupils and talk through the code.
https://replit.com/@STACSSupport/Teachers-Debug-43-Total-Points?v=1
solution
# prints a blank line
print
(
'\n'
)
# set total to 0
total
=
0
# ask user for first event points and stores user input
eventOne
=
int
(
input
(
'Enter the first event points: '
)
)
# add next points
total
=
total
+
eventOne
;
# ask user for second event points and stores user input
eventTwo
=
int
(
input
(
'Enter the second event points: '
)
)
# add next points
total
=
total
+
eventTwo
;
# ask user for third event points and stores user input
eventThree
=
int
(
input
(
'Enter the third event points: '
)
)
# add next points
total
=
total
+
eventThree
;
# ask user for fourth event points and stores user input
eventFour
=
int
(
input
(
'Enter the fourth event points: '
)
)
# add next points
total
=
total
+
eventFour
;
# ask user for fifth event points and stores user input
eventFive
=
int
(
input
(
'Enter the fifth event points: '
)
)
# add next points
total
=
total
+
eventFive
;
# prints a blank line
print
(
'\n\n'
)
# display total number
print
(
str
(
eventOne
)
+
" + "
+
str
(
eventTwo
)
+
" + "
+
str
(
eventThree
)
+
" + "
+
str
(
eventFour
)
+
" + "
+
str
(
eventFive
)
+
" = "
+
str
(
total
)
)
;
Gallery
Share
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.