Computer Science 2
*********
*********
Due Date: August 25, 2023
Hello CS 2 students,

Click here and complete the W3School activities listed below.

Signup - use your school e-mail.

If it asks you to pay, do not.
We are using the free part of this system.

Complete the following:

 


*********
*********
Due Date: August 21, 2023
Having a little artistic fun....
Look at the two pictures.
 

Find a picture of yourself. Click on this link and convert this image. Save the image as PX_painting_lastname.jpg Drop off your file into google classroom. Click here and I will show you how to do this.

*********
*********
Due Date: August 21, 2023
Update your name on W3School to your first name.
Add KC2023to24_PX to the end. 
The X at the end ws your period.
In my case, my name would be JoeKC2023to24_P9.png.
Use the picture and update your profile on W3School.
Click here to see how to get your score.

*********
*********
Due Date: August 21, 2023
Now you need to provide me with your W3School Python score.
Your file name should be PX_20230818_W3S_Score.png.
Be sure to drop it off into google classroom.
See example below:
 

*********
*********
Due Date: August 1, 2023
Sure, here's a beginner-level Python 
assignment that involves creating a 
program to manage student attendance 
at a school. This assignment assumes 
that students have unique IDs, and 
it focuses on basic input/output and 
conditional statements. 

**Assignment: Student Attendance System**

**Instructions:**

You have been tasked with creating a 
simple student attendance system for 
a school. Your program should allow 
the user to mark students as present 
or absent and then display the 
attendance status for each student.

Follow the steps below to complete
the assignment:

1. Create an empty dictionary called
`student_attendance` to store the 
attendance status of each student. 
The keys of the dictionary will 
be the student IDs (which you can
assume to be unique), and the 
values will represent the 
attendance status (either 
"Present" or "Absent").

2. Implement a function called 
`mark_attendance` that takes two 
parameters: the `student_id` and 
`status` (which can be either "P" 
for "Present" or "A" for "Absent").
The function should update the 
attendance status of the given student.

3. Implement a function called 
`display_attendance` that displays 
the attendance status of all students.
It should go through the `student_attendance`
dictionary and print out each student's ID
and attendance status.

4. In your main program, prompt the user
to perform the following actions:
   - Mark attendance for a student by 
   entering the student's ID and their
   attendance status ("P" or "A").
   - Display the attendance status of 
   all students.

5. Use a loop to allow the user to 
continuously interact with the program
until they choose to exit.

**Grading Criteria:**

- Correct implementation of the
`student_attendance` dictionary.
- Correct implementation of the 
`mark_attendance` function.
- Correct implementation of the 
`display_attendance` function.
- Proper user interface for 
marking attendance and displaying 
information.
- Correct usage of loops and 
conditional statements.
- Neat and organized code with appropriate comments.


**Sample Output:**

```
Student Attendance System

1. Mark Attendance
2. Display Attendance
3. Exit


Enter your choice: 1
Enter student ID: 101
Enter attendance status (P/A): P
Attendance marked for student 101.

Enter your choice: 1
Enter student ID: 102
Enter attendance status (P/A): A
Attendance marked for student 102.

Enter your choice: 2
Attendance:
Student ID: 101 - Status: Present
Student ID: 102 - Status: Absent

Enter your choice: 3
Goodbye!
```

Solution:

Of course! Below is the solution
code for the Python assignment on 
the student attendance system:

```python
# Create an empty dictionary to 
# store student attendance
student_attendance = {}

# Function to mark attendance
def mark_attendance(student_id, status):
    if status.upper() == "P":
        student_attendance[student_id] = "Present"
        print("Attendance marked for student", student_id)
    elif status.upper() == "A":
        student_attendance[student_id] = "Absent"
        print("Attendance marked for student", student_id)
    else:
        print("Invalid attendance status. Please enter 'P' for Present or 'A' for Absent.")

# Function to display attendance
def display_attendance():
    print("Attendance:")
    for student_id, status in student_attendance.items():
        print("Student ID:", student_id, "- Status:", status)

# Main program
print("Student Attendance System\n")
while True:
    print("1. Mark Attendance")
    print("2. Display Attendance")
    print("3. Exit")
    
    choice = input("\nEnter your choice: ")
    
    if choice == "1":
        student_id = input("Enter student ID: ")
        attendance_status = input("Enter attendance status (P/A): ")
        mark_attendance(student_id, attendance_status)
    elif choice == "2":
        display_attendance()
    elif choice == "3":
        print("Goodbye!")
        break
    else:
        print("Invalid choice. Please select a valid option.")
```

Copy and paste this code into a Python 
interpreter or a .py file to run and 
test it. The code defines the `mark_attendance`
and `display_attendance` functions to manage
attendance and display the information. 
The main program uses a loop to repeatedly
prompt the user for actions until they choose to exit.

*********
*********
Due Date: August 1, 2023


*********
*********
Due Date: August 1, 2023


*********
*********
Due Date: August 1, 2023