Common Computer Science References
At the end of this lesson, you will be able to:
understand and create an array (or list in python)
passing parameters
python actually does not have arrays, it only has lists
we will just assume lists are like arrays for now!
go over Arrays, Computer Based Problem Solving
nil
create a program that generates 10 random numbers between 1 and 100
the program places them in a single variable (an array or list in python) and prints them to the console
after the array is full, calculates the average of the numbers and display it
no using any built in functions, use a loop to calculate the average, to 1 decimal place
do not hard code any numbers, use len() to get the length of list
do not create a user defined function, just place everything in main() for this program
please note the following:
your array (list!) declaration will be like this in Python:
my_numbers = []
no need to use a function today, we will learn how to pass arrays to functions next
just place all the code in main()
your Test Cases will not be normal, you are generating random numbers so you do not know them in advance
just have 1 test case explaining how you are going to check to ensure the result is correct
then under each of the 3 screen shots of the program running, do the calculation to prove it is correct
recreate the same above program in C
int arr[] = {10,20,30,40,50,60};
int arrSize = sizeof(arr)/sizeof(arr[0]);
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.