Gallery
Solution Calculations
Share
Explore
Solution Calculations

icon picker
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.


solution
# 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
additionAnswer = numberOne + numberTwo
# set subtractionAnswer to numberOne **minus** numberTwo
subtractionAnswer = numberOne - numberTwo
# *set multiplyAnswer to numberOne **multiplied** by numberTwo*
multiplyAnswer = numberOne * numberTwo
# *set divisionAnswer to numberOne **divided** by numberTwo*
divisionAnswer = numberOne / numberTwo
# display message with numberOne, numberTwo and additionAnswer
print(numberOne , '+' , numberTwo, '=' , additionAnswer)

# display message with numberOne, numberTwo and subtractionAnswer
print(numberOne , '-' , numberTwo, '=' , subtractionAnswer)
#display message with numberOne, numberTwo and **multiplyAnswer***
print(numberOne , '*' , numberTwo, '=' , multiplyAnswer)

#display message with numberOne, numberTwo and **divisionAnswer***
print(numberOne , '/' , numberTwo, '=' , divisionAnswer)
original
# 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***

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.