Lab 2 String, Number, and Variables in

Опубликовано: 14 Май 2026
на канале: LBSocial
808
2

Objectives:
• To get familiar with basic data types and variables 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 lab2.py, and try to answer the following questions.
3.1. Define a string variable as my_name, assign Tom to the variable, and print my_name in upper cases.
3.2. Define an integer variable as my_id, and assign 123 to my_id, and print my_id.
3.3. Can you define 123 = my_id? Why? What about my_id = your_id = 123? If yes, print the result; if not, put the code into comments?
3.4. Define a string variable as my_id_str, assign the 123 to my_id_str in string format, and print my_id_str.
3.5. Can you perform my_name + my_id? If yes, print the result; if not, put the code into comments?
3.6. Can you perform my_name + my_id_str? If yes, print the result; if not, put the code into comments?
3.7. Can you perform my_name * 3? If yes, print the result; if not, put the code into comments?
3.8. Split the string hello, world. This is my first python string. based on . , print the result.
3.9. Define a message variable like message ='Tom's id is 123'. Can you print the message available? If yes, print the result; if not, put the code into comments?
4. Upload the new python file to GitHub by typing the following command in the terminal. You do not need to type the account and token as they are already stored on the Cloud9 instance disk.
git add --all
git commit -m "my lab2.py file."
git push
5. Go to your GitHub repository and check the changes.