Fall 2024 - P2
Big Idea 3 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .10 |
3.2 Lesson Period 2 - Float Data Abstraction
Student led teaching on Abstraction. Teaching how various data types can use abstraction for copmutational efficiency.
Floats - 3.2.2
numberOfChocolatePieces = 4.5 # this is an abstraction as to write this with integers you would have to write 9/2 which adds complexity
numberOfFruitPieces = 7/2
print("Number of Chocolate Pieces", numberOfChocolatePieces)
print("Number of Fruit Pieces", numberOfFruitPieces)
print("Number of Chocolate Pieces and Number of Fruit Pieces", numberOfChocolatePieces + numberOfFruitPieces)
Number of Chocolate Pieces 4.5
Number of Fruit Pieces 3.5
Number of Chocolate Pieces and Number of Fruit Pieces 8.0
Javscript Version
%%js
let numberOfChocolatePieces = 4.5;
let numberOfFruitPieces = 7/2;
console.log("Number of Chocolate Pieces", numberOfChocolatePieces);
console.log("Number of Fruit Pieces", numberOfFruitPieces);
console.log("Number of Chocolate Pieces and Number of Fruit Pieces", numberOfChocolatePieces + numberOfFruitPieces);