What I learned

HW

isComplete = {'Student 1': 1, 'Student 2': 1, 'Student 3': 0, 'Student 4': 1, 'Student 5': 0, 'Student 6': 1}
isOnTime = {'Student 1': 1, 'Student 2': 0, 'Student 3': 0, 'Student 4': 1, 'Student 5': 1, 'Student 6': 1}
## Program Here
#Code for Bob
values_complete = list(isComplete.values())
values_time = list(isOnTime.values())
students = {'Student 1': '', 'Student 2': '', 'Student 3': '', 'Student 4': '', 'Student 5': '', 'Student 6': ''}

for student in range(len(values_complete)):
    if values_complete[student] and values_time[student]:
        students[student] = 'Complete'
    elif not(values_complete[student] and values_time[student]):
        students[student] = 'Incomplete'


for stu in students:
    print(f"{stu}: {students[stu]}")
    print('\n')

#Interactive code that uses logic gates
def ready_for_school():
    brushed = [True if input("Did you brush your teeth [Y/N]").upper() == "Y" else False][0]
    changed = [True if input("Did you change to school-appropriate clothes [Y/N]").upper() == "Y" else False][0]
    ate = [True if input("Did you eat breakfast [Y/N]").upper() == "Y" else False][0]
    packed = [True if input("Did you pack all your homework and notebooks [Y/N]").upper() == "Y" else False][0]
    time = [True if input("Do you have more than 10 minutes to spare [Y/N]").upper() == "Y" else False][0]
    sick = [True if input("Are you sick? [Y/N]").upper() == "Y" else False][0]
        
    ready = 0

    if (brushed and changed) or ate:
        ready += 1
    else:
        ready -= 1
    
    if not packed:
        ready -= 1
    else:
        ready += 1

    if time and not sick:
        ready += 2
    else:
        if not time:
            ready -= 2
        else:
            print("Don't go to school today!")

    if ready < 0 and not sick:
        print("You'll get to school on time")
    else:
        print("You'll be late to school today")

ready_for_school()
## Example output: {'Student 1': 'Incomplete', 'Student 2': 'Incomplete', 'Student 3': 'Incomplete', 'Student 4': 'Incomplete', 'Student 5': 'Incomplete', 'Student 6', 'Complete'}
## Extra: Format the output nicely```

def andgate(a, b): if a and b: return True elif not (a and b): return False

def orgate(a, b): if a or b: return True else: return False

def xorgate(a, b): if andgate(orgate(a, b), nandgate(a, b)): return True else: return False

print(xorgate(True, True)) print(xorgate(True, False)) print(xorgate(False, True)) print(xorgate(False, False)) ```