Objectives:
• To get familiar with List and Set in Python
Data:
• None
Steps:
1. Log into the AWS console, and start your environment in Cloud9.
2. In the terminal, update your local repository by typing:
git pull
3. Create a new python script, name it lab3.py, and try to answer the following questions.
3.1. Create a list variable as str_list with the string values: 'a', 'd', 'e', 'b', 'c'. Can you sort the str_list? If yes, print the result. If not, put the code in a comment.
3.2. Add a new string f into str_list, and print the str_list.
3.3. Remove the string d from the str_list, and print the str_list.
3.4. Print the string c from the str_list by using the index.
3.5. Create a list as my_list, including: 'a',' 123', 123, 'b', 'B', 'False', False, 123, None, 'None'. How many unique items are on my_list?
3.6. Calculate the number of words in the sentence: "This is my third python lab."
3.7. Create a list as num_list with the numbers: 12, 32, 43, 35. Design your python codes to print the maximal item and the minimal item of the num_list, respectively. Don’t use the max() function or the min() function.
3.8. Define a game_board list as
[ [0,0,0],
[0,0,0],
[0,0,0]]
and print the game_board. Change the game_board as
[ [0,0,0],
[0,1,0],
[0,0,0]]
with index and print the changed game_board.
4. Upload the new python file to GitHub by typing the following command in the terminal:
git add --all
git commit -m "added my lab3.py file."
git push
5. Go to your GitHub repository and check the changes.