Activity 1: Names Printer
Part 1 (5 points): Declare an array of 5 strings and initialize it with 5 names of their choice.
Part 2 (5 points): Write a for loop to print each name in the array.
Activity 2: Days of the Week
Part 1 (5 points): Declare an array of 7 strings and initialize it with the names of the days of the week.
Part 2 (5 points): Write a for loop to print each day in the array.
Activity 3: Grades Calculator
Part 1 (5 points): Ask students to declare an array of 10 integers and initialize it with 10 random grades of their choice (0 to 100).
Part 2 (15 points): Write a for loop to calculate the average grade.
Answers & Comments
Answer:
Sure, here are the solutions to the three activities you mentioned:
Activity 1: Names Printer
Part 1:
```python
names = ["Alice", "Bob", "Charlie", "Dave", "Eve"]
```
Part 2:
```python
for name in names:
print(name)
```
Output:
```
Alice
Bob
Charlie
Dave
Eve
```
Activity 2: Days of the Week
Part 1:
```python
days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
```
Part 2:
```python
for day in days:
print(day)
```
Output:
```
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
```
Activity 3: Grades Calculator
Part 1:
```python
grades = [85, 92, 78, 90, 88, 95, 80, 83, 79, 87]
```
Part 2:
```python
sum = 0
for grade in grades:
sum += grade
average = sum / len(grades)
print("Average grade:", average)
```
Output:
```
Average grade: 85.7
```