Common Computer Science References
At the end of this lesson, you will be able to:
start to understand passing parameters by reference vs value
passing parameters
go over By Reference , Computer Based Problem Solving
nil
create a program that will accept a number with decimals
you then tell the program how many decimal places you want to round off to
the program then passes the variables in by reference to a function and rounds it off to that many decimal places
you CAN NOT use any built in rounding function
Hint:
multiply number by 10 to the power of how many decimal points you want
add 0.5
convert to integer
move decimal point back
for python you can not pass a primitive type by reference so you will have to pass the variable in a list
like what we have been doing in CircuitPython
number_var = []
number_var.append(number)
recreate the same above program in another language
NOTE: You can turn on "Closed Captions" to see a printout of what is being said by selecting the "CC" button.
You can also have it translate the closed captions by going to "Settings, Subtitles/CC, Auto-translate" and then pick your prefered language.