Calculations

The goal of this lesson is to learn to do calculations, use counters, and find totals.
These calculations will enable you to move the characters more precisely in the Alice virtual world.

In this module, you will use arithmetic operators to move the characters to precise locations, to find totals, and other calculations.
In order to do this you will:

  • Build arithmetic expressions.
  • Use variables, functions, and assign statements.
  • Create code to do calculations using multiple variables and steps.
  • Write a function to do calculations.
  • Create a function to get distance to move next to something
  • Use a loop to add numbers uses a running total: total=total + number

Print the lesson

Please study the material at each of the links below.

  1. Counters: Using a while loop to count using counter=counter+1
  2. Cost of 3 Soccer Balls: How much does one soccer ball cost? total=cost * 3
  3. Cost of 3 different items: Finds the total of 3 different values: total=total+cost
  4. Calculate Distance to Move: Distance to move to be next to something
  5. Writing functions: Create a function to get distance to move next to something
  6. Loop to add numbers: A loop to add numbers uses a running total: total=total + number
  7. Loop to add numbers and find smallest and largest: The first value is the smallest and largest so far.
  8. Self Study Questions
  9. Discussion Questions

Active Learning

Move to and Jump on top

Like us on Facebook:


OER: Open Educational Resource
Creative Commons License Author: Janet E. Joy; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: May 17 2017 14:11:30.