filmov
tv
Lab 6 for Loop and range Function in #Python

Показать описание
Objectives:
To get familiar with for loop and range function
Data:
None
Steps:
1. Log in to the AWS console, and start your environment in Cloud9.
2. In the terminal, update your local repository by typing:
git pull
3.1 Use for loop, if statement, and range function to print numbers from 0 to 5 except 3.
3.2 Use for loop and range function to calculate 5×4×3×2×1
3.3 Use for loop and range function to calculate 1+2+3+4+5
3.4 Use for loop and range function to calculate 3×4×5×6×7×8
3.5 Use for loop and range function to calculate (8×7×6×5×4×3×2×1)/(3×2×1)
3.6 Use for loop to count the number of words in this string: 'this is my 6th string'.
3.7 Create a dictionary variable as my_tweet like this:
{
"favorite_count":1138,
"lang": "en",
"coordinates": (-75, 40),
"entities": {“hashtags”: ["Preds", "Pens", "SingIntoSpring"]}
}
Use for loop to count the number of hashtags.
4. Upload the new python file to GitHub by typing the following command in the terminal:
git add --all
git commit -m "some notes here."
git push
5. Go to your GitHub repository and check the changes.
To get familiar with for loop and range function
Data:
None
Steps:
1. Log in to the AWS console, and start your environment in Cloud9.
2. In the terminal, update your local repository by typing:
git pull
3.1 Use for loop, if statement, and range function to print numbers from 0 to 5 except 3.
3.2 Use for loop and range function to calculate 5×4×3×2×1
3.3 Use for loop and range function to calculate 1+2+3+4+5
3.4 Use for loop and range function to calculate 3×4×5×6×7×8
3.5 Use for loop and range function to calculate (8×7×6×5×4×3×2×1)/(3×2×1)
3.6 Use for loop to count the number of words in this string: 'this is my 6th string'.
3.7 Create a dictionary variable as my_tweet like this:
{
"favorite_count":1138,
"lang": "en",
"coordinates": (-75, 40),
"entities": {“hashtags”: ["Preds", "Pens", "SingIntoSpring"]}
}
Use for loop to count the number of hashtags.
4. Upload the new python file to GitHub by typing the following command in the terminal:
git add --all
git commit -m "some notes here."
git push
5. Go to your GitHub repository and check the changes.