Assignment1.py
def option2(people, levels, read, year, month, day, theme):
    '''
    Validates a given LCN and fetchs the birth date of the given participant. Given their birth date, computes
    their age. Then parses through books read dictionary using the LCN given and counts and prints the books 
    they read (while adding a * to the book name after the 23rd character in the book name). With the number 
    of books read, will assign a rank based off of clublevel.txt. Below are index's for easier readability /
    debugging.

           personKey = ID       bookKey = ID            levelKey = LEVEL NAME
           person[0] = FNAME    book[0] = BRANCH        level[0] = NAME
           person[1] = LNAME    book[1] = BOOK NAME     level[1] = RANK CUTOFF
           person[2] = DATE                             

    Para:   People: dictionary
            levels: dictionary
            read: dictionary
            year: integer 
            month: integer
            day: integer
            theme: string

    Returns:
            None
    '''
    lcn = input('Library Card Number: ')
    if validateLcn(lcn, people) == False:
        return print('Invalid library card number.')
    born = people[lcn][2]
    count = 0
    fName, lName = firstName(people[lcn][0]).upper(), lastName(people[lcn][1]).upper()
    age, currentDate = getAge(year, month, day, born), fixCurrentDate(year, month, day)
    print('\nReport for:    {:>8s} {}'.format(fName, lName))
    print('Age on {}:  {:>5}'.format(currentDate, age))
    print('-------------------------')
    print('Books read: ')

    if lcn in read:
        for value in read[lcn]:
            count += 1 
            if len(value[1]) > 23:
                value[1] = value[1][:23] + '*'
            print('-{}'.format(value[1]))

    # if there are no books in the dictionary given their ID
    else:
        print('None yet...')

    print('-------------------------')
    print('Total books read:   {:>5}'.format(count))
    rank = getRank(theme, count, levels).upper()
    print('Level:       {:>12s}'.format(rank))
    print('-------------------------')
    return

    Validates a given LCN and fetchs the birth date of the given participant. Given their birth date, computes
    their age. Then parses through books read dictionary using the LCN given and counts and prints the books 
    they read (while adding a * to the book name after the 23rd character in the book name). With the number 
    of books read, will assign a rank based off of clublevel.txt. Below are index's for easier readability /
    debugging.

           personKey = ID       bookKey = ID            levelKey = LEVEL NAME
           person[0] = FNAME    book[0] = BRANCH        level[0] = NAME
           person[1] = LNAME    book[1] = BOOK NAME     level[1] = RANK CUTOFF
           person[2] = DATE                             

    Para:   People: dictionary
            levels: dictionary
            read: dictionary
            year: integer 
            month: integer
            day: integer
            theme: string

    Returns:
            None
    
Validates a given LCN and fetchs the birth date of the given participant. Given their birth date, computes
their age. Then parses through books read dictionary using the LCN given and counts and prints the books
they read (while adding a * to the book name after the 23rd character in the book name). With the number
of books read, will assign a rank based off of clublevel.txt. Below are index's for easier readability
debugging.




Validates a given LCN and fetchs the birth date of the given participant . Given their birth date computes their age . Then parses through books read dictionary using the LCN given and counts and prints the books they read ( while adding a * to the book name after the 23rd character in the book name ) . With the number of books read will assign a rank based off of clublevel . txt . Below are index ' s for easier readability debugging .
def option2(people, levels, read, year, month, day, theme):
    lcn = input('Library Card Number: ')
    if validateLcn(lcn, people) == False:
        return print('Invalid library card number.')
    born = people[lcn][2]
    count = 0
    fName, lName = firstName(people[lcn][0]).upper(), lastName(people[lcn][1]).upper()
    age, currentDate = getAge(year, month, day, born), fixCurrentDate(year, month, day)
    print('\nReport for:    {:>8s} {}'.format(fName, lName))
    print('Age on {}:  {:>5}'.format(currentDate, age))
    print('-------------------------')
    print('Books read: ')
    if lcn in read:
        for value in read[lcn]:
            count += 1 
            if len(value[1]) > 23:
                value[1] = value[1][:23] + '*'
            print('-{}'.format(value[1]))
    else:
        print('None yet...')
    print('-------------------------')
    print('Total books read:   {:>5}'.format(count))
    rank = getRank(theme, count, levels).upper()
    print('Level:       {:>12s}'.format(rank))
    print('-------------------------')
    return
def option2 ( people , levels , read , year , month , day , theme ) : lcn = input ( 'Library Card Number: ' ) if validateLcn ( lcn , people ) == False : return print ( 'Invalid library card number.' ) born = people [ lcn ] [ 2 ] count = 0 fName , lName = firstName ( people [ lcn ] [ 0 ] ) . upper ( ) , lastName ( people [ lcn ] [ 1 ] ) . upper ( ) age , currentDate = getAge ( year , month , day , born ) , fixCurrentDate ( year , month , day ) print ( '\nReport for:    {:>8s} {}' . format ( fName , lName ) ) print ( 'Age on {}:  {:>5}' . format ( currentDate , age ) ) print ( '-------------------------' ) print ( 'Books read: ' ) if lcn in read : for value in read [ lcn ] : count += 1 if len ( value [ 1 ] ) > 23 : value [ 1 ] = value [ 1 ] [ : 23 ] + '*' print ( '-{}' . format ( value [ 1 ] ) ) else : print ( 'None yet...' ) print ( '-------------------------' ) print ( 'Total books read:   {:>5}' . format ( count ) ) rank = getRank ( theme , count , levels ) . upper ( ) print ( 'Level:       {:>12s}' . format ( rank ) ) print ( '-------------------------' ) return
Validates a given LCN and fetchs the birth date of the given participant.
Validates a given LCN and fetchs the birth date of the given participant .
'''
    Validates a given LCN and fetchs the birth date of the given participant. Given their birth date, computes
    their age. Then parses through books read dictionary using the LCN given and counts and prints the books 
    they read (while adding a * to the book name after the 23rd character in the book name). With the number 
    of books read, will assign a rank based off of clublevel.txt. Below are index's for easier readability /
    debugging.

           personKey = ID       bookKey = ID            levelKey = LEVEL NAME
           person[0] = FNAME    book[0] = BRANCH        level[0] = NAME
           person[1] = LNAME    book[1] = BOOK NAME     level[1] = RANK CUTOFF
           person[2] = DATE                             

    Para:   People: dictionary
            levels: dictionary
            read: dictionary
            year: integer 
            month: integer
            day: integer
            theme: string

    Returns:
            None
    ''' # if there are no books in the dictionary given their ID

None
people
levels
read
year
month
day
theme