First we make the list withe the following names. Once this is done we then make a for loop with the variable x. Once that was been done we call the variable which consists of the list so it repeats the list
when we have a word containing a definitions we must call the definitions using the brackets. So before calling the bracket we must call the variable but include the brackets and inside those brackets must contain the variable in order to call the definition inside.
So now the list we have contains a set of numbers from the 0 to 12, in order to call the list while being squared we use the same for loop but include “**2” which the squares all the numbers inside at the list. Finally we must call the variable.
a simple count function
code academy demonstrating the usage of a list.
So the example we use is that we own a fruit shop. the fruit we have must have a price so we assign each fruit with a price using the list function.
Of course we cannot have unlimited amounts of fruits. so we must have a stock of them. Sadly we have no bananas, however we have plenty of oranges
Okay now let’s play the customer, so if we were to be the customer the price would be determined by the fruit price+ the fruit stock. So price plus the quantity will determine the price.
our last situation we use is groceries. Our groceries are banana, apple, and orange
So with the past list we have created, whatever we buy is price of each product+ price of each product.
For those customers that want an item that is no longer available we must also include that and subtract it if it was included.
Finally we return
The main purpose of the assignment is to go more in debt of the use of the list. The list’s purpose is to sort out information in a specific way depending what’s in the list. List’s not only hold information but can also be used to mix with other information to your choosing. The usage of a list is good practice for the assortment of information overall.