15. Lists

List is a group of elements. list can be like the list of students in the class, list of phone numbers, list of vehicles. In the future we will learn how to make some actions on list.
Before we start let's clean the screen
To create a list we should have a variable containing the list values (we have learned before how to define a variable). the definition of list is : (list item1 item2 ....) when the list items are separated by space (list "turtle "academy) will contain 2 element the first is the string 'turtle' and the second will be the string 'academy'. Now we will have to define a variable to hold the list.
Lets define a variable mylist which hold a list of 2 elements the string 'turtle' 'academy'
In the previous step we have defined mylist that contain 2 itms 'turtle' 'academy' . in order to print the list content we will have to use the print command and access the :mylist content.
Print the list mylist
We saw before how we can create a list, lets try to create a list with 5 elements.
Create a list name listfive with the following string "first "second "third " fourth " five
We have alraedy created a new list why not to print her.
Print the listfive list
To print the first element of a list we will need to use the print command along with first print first :LISTNAME
Print the listfive first element
Like we saw in privous step we have some command that help to access the list. The command for accessing the last element of the list will be last. In order to print we will need print last LIST_NAME.
Print the last element of listfive
TurtleAcademy learn programming for freeYour browser is not supporting canvasWe recomand you to use Chrome or Firefox browsers