JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Calculations with starter code
Share
Explore
Gallery
Calculations with starter code
Calculations with starter code
The Task
Python Starter Code
Code Clips
Python Starter Code
Copy and paste the code below into your
main.py
file before you begin the task.
# Calculation
# prompt for first number
# get numberOne from keyboard
numberOne
=
int
(
input
(
'Please enter the first number: '
)
)
# prompt for second number
# get numberTwo from keyboard
numberTwo
=
int
(
input
(
'Please enter the second number: '
)
)
# set additionAnswer to numberOne **add** numberTwo
# set subtractionAnswer to numberOne **minus** numberTwo
# set multiplyAnswer to numberOne **multiplied** by numberTwo*
# set divisionAnswer to numberOne **divided** by numberTwo*
# display message with numberOne, numberTwo and additionAnswer
print
(
numberOne
,
'+'
,
numberTwo
,
'='
,
additionAnswer
)
# display message with numberOne, numberTwo and subtractionAnswer
#display message with numberOne, numberTwo and **multiplyAnswer***
#display message with numberOne, numberTwo and **divisionAnswer***
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.