# Simple Python Program to demonstrate Boolean expressions and logic with loops

# Set variables for the examples in the program
students = [
    {'name': 'Yuki Tanaka', 'age': 22, 'GPA': 3.8, 'level': 'senior', 'is_resident': True},
    {'name': 'Swathi Donda', 'age': 21, 'GPA': 3.9, 'level': 'junior', 'is_resident': True},
    {'name': 'Penny Rice', 'age': 18, 'GPA': 3.2, 'level': 'freshman', 'is_resident': True},
    {'name': 'Della Reese', 'age': 22, 'GPA': 4.0, 'level': 'senior', 'is_resident': False},
    {'name': 'Lin Ana', 'age': 23, 'GPA': 3.4, 'level': 'senior', 'is_resident': False},
    {'name': 'Mark Casper', 'age': 20, 'GPA': 2.9, 'level': 'junior', 'is_resident': False},
    {'name': 'Jordan Blake', 'age': 23, 'GPA': 3.1, 'level': 'sophomore', 'is_resident': True},
    {'name': 'Aisha Patel', 'age': 24, 'GPA': 3.7, 'level': 'senior', 'is_resident': True},
    {'name': 'Carlos Mendez', 'age': 21, 'GPA': 2.6, 'level': 'sophomore', 'is_resident': True},
    {'name': 'Brianna Foster', 'age': 21, 'GPA': 3.8, 'level': 'freshman', 'is_resident': True},
    {'name': 'Anthony Jackson', 'age': 20, 'GPA': 2.1, 'level': 'junior', 'is_resident': False},
    {'name': 'Sabrina Gale', 'age': 25, 'GPA': 3.3, 'level': 'sophomore', 'is_resident': True},
    {'name': 'Phillip Quinn', 'age': 29, 'GPA': 3.7, 'level': 'senior', 'is_resident': True},
    {'name': 'Gary Franklin', 'age': 21, 'GPA': 2.6, 'level': 'sophomore', 'is_resident': True},
    {'name': 'Gavin Brown', 'age': 21, 'GPA': 3.8, 'level': 'freshman', 'is_resident': True}
]
# Student variables
student_number = 0
current_student = students[0] # Set student to Yuki Tanaka for the examples
age = current_student['age']
gpa = current_student['GPA']    
grade_level = current_student['level']
is_resident = current_student['is_resident']

# Calendar variable 
day_of_week = "Saturday"
print(f"Today is {day_of_week}.")

# College mixer variables
tickets_sold = 93
max_tickets = 100
print(f"Tickets to the college mixersold: {tickets_sold}/{max_tickets}")

# 1. Greater than / Less than
if max_tickets - tickets_sold > 0:
    print("There are still tickets available to the mixer.")  # This will print because there are still tickets available
    
print(f"\nCurrent student: {current_student}")

# 2. Equality Check
if grade_level == "senior":
    print("\tYou should register for graduation.")  # This will print because grade_level is "senior"

# 3. Inequality Check
if gpa != 4.0:
    print("\tYou do not have a perfect GPA.")  # This will print because gpa is not 4.0

# 4. Combining Booleans (AND)
if age > 18 and age < 30:
    print("\tYou are a young adult.")  # This will print because both conditions are true

# 5. Combining Booleans (OR)
if age < 18 or age > 65:
    print("\tYou can get a special discount to the movies.")  # This won't print because neither condition is true

# 6. Negation (NOT)
if not is_resident:
    print("\tAs a non-resident, you cannot access certain facilities.")  # This will not print because is_resident is True

# 7. Using Booleans in Complex Conditionals
if age < 18:
    print("You are a minor.")
elif is_resident and age < 30:
    print("\tYou are a young resident.")  # This will print because both conditions are true
else:
    print("\tYou are neither a minor nor a young resident.")

# 8. Check if it's the weekend and the person is a resident 21 or older to allow alcohol
if ((day_of_week == "Saturday" or day_of_week == "Sunday") and is_resident and age >= 21):
    print("\tYou can bring alcohol to the dorms this weekend.")  
    # This will print because it's the weekend, and the person is a resident and over 21

# 9. While tickets sold is less than max available tickets, let people in line purchase a ticket
print("\nSelling tickets to the mixer...")
while tickets_sold < max_tickets and student_number < len(students):
    # Simulate selling a ticket to the current student
    current_student = students[student_number]
    
    if (current_student['age'] < 21):
        print(f"\t\t {current_student['name']} is under 21 and cannot purchase a ticket.")
        student_number += 1
        continue  # Skip to the next student

    elif (not current_student['is_resident']):
        print(f"\t\t {current_student['name']} is not a resident and cannot purchase a ticket.")
        student_number += 1
        continue  # Skip to the next student
    else:
        tickets_sold += 1
        print(f"\t- Ticket {tickets_sold} sold to {current_student['name']}")
        student_number += 1

        if tickets_sold >= max_tickets:
            print("\n   *** The party is full! No more tickets available.\n")