<commit_before># !/usr/bin/env python3

"""
Name: <NAME>
Date: 10/11/16
Class: Introduction to Python
LAB: List Lab

Description:

"""
# -------------------------------Functions--------------------------------------


def series1(fruit):
    """
    Take in a list of strings and displays the original list before prompting
    the user to add additonal items to the list. The original list is modified
    based on user input and insertions to the beginning of the list.
    """
    print(fruit)
    # Prompts user for an additional fruit
    new_fruit = input("Please enter another fruit ")
    fruit.append(new_fruit)
    # Add some cool text formatting
    print(fruit)
    number = int(input("Please enter a number "))
    # Ask about 'one is first basis'.
    print(number, fruit[number])
    # Adds new fruit to beginning of list using concatenation
    fruit = ["Watermelon"] + fruit
    print(fruit)
    # Inserts new fruit at beginning of list
    fruit.insert(0, "Pineapple")
    print(fruit)
    # displays all fruits beginning with the letter 'P'
    for item in fruit:
        if item[0] == 'P':
            print(item)


def series2(fruit):
    """
    Take in a list of strings and display the original list before removing the
    last element of the list and prompting the user for a specific item to
    remove from the list.
    """
    print(fruit)
    # Remove last element from list
    del fruit[-1]
    print(fruit)
    # Prompts user for a fruit to remove from list
    to_delete = input("What fruit do you want deleted from this list? ")
    fruit.remove(to_delete)


def series3(fruit):
    """
    Take in a list of strings and iterate through it prompting the user regarding
    their preference for each fruit. If the user does not like the fruit, it is
    deleted from the list. If the user does not specify their preference,
    they are prompted until they do. A list of remaining fruit is displayed
    after the user has specified their preference for each fruit.
    """
    for item in fruit:
        # Asks the user whether they like each fruit
        preference = input("Do you like " + item.lower() + "? yes|no ")
        # Checks to make sure user entered either 'yes' or 'no'
        if preference != 'no' and preference != 'yes':
            # Repeatedly prompts user to enter 'yes' or 'no' until they do.
            while True:
                preference = input("Please answer with either yes or no ")
                if preference == 'yes' or preference == 'no':
                    # Ask about using break instead of False
                    return False
        if preference == 'no':
            # remove item from fruit
            fruit.remove(item)
    print(fruit)


def series4(fruit):
    """
    Take in a list of strings and reverse each letter of each item. Display the
    original list minus the last element and it's copy.
    """
    # Create copy of fruit
    rev_fruit = fruit[:]
    rev_fruit = " ".join(rev_fruit)
    rev_fruit = rev_fruit[::-1]
    rev_fruit = rev_fruit.split()
    rev_fruit.reverse()
    # Delete last item in original list<commit_msg>Added some questions in regards to series4.<commit_after># !/usr/bin/env python3

"""
Name: <NAME>
Date: 10/11/16
Class: Introduction to Python
LAB: List Lab

Description:

"""
# -------------------------------Functions--------------------------------------


def series1(fruit):
    """
    Take in a list of strings and displays the original list before prompting
    the user to add additonal items to the list. The original list is modified
    based on user input and insertions to the beginning of the list.
    """
    print(fruit)
    # Prompts user for an additional fruit
    new_fruit = input("Please enter another fruit ")
    fruit.append(new_fruit)
    # Add some cool text formatting
    print(fruit)
    number = int(input("Please enter a number "))
    # Ask about 'one is first basis'.
    print(number, fruit[number])
    # Adds new fruit to beginning of list using concatenation
    fruit = ["Watermelon"] + fruit
    print(fruit)
    # Inserts new fruit at beginning of list
    fruit.insert(0, "Pineapple")
    print(fruit)
    # displays all fruits beginning with the letter 'P'
    for item in fruit:
        if item[0] == 'P':
            print(item)


def series2(fruit):
    """
    Take in a list of strings and display the original list before removing the
    last element of the list and prompting the user for a specific item to
    remove from the list.
    """
    print(fruit)
    # Remove last element from list
    del fruit[-1]
    print(fruit)
    # Prompts user for a fruit to remove from list
    to_delete = input("What fruit do you want deleted from this list? ")
    fruit.remove(to_delete)


def series3(fruit):
    """
    Take in a list of strings and iterate through it prompting the user regarding
    their preference for each fruit. If the user does not like the fruit, it is
    deleted from the list. If the user does not specify their preference,
    they are prompted until they do. A list of remaining fruit is displayed
    after the user has specified their preference for each fruit.

    Questions:
    Best way to ensure each element is lowercase.
    How to avoid skipping elements when the element before them is deleted.
    Best way of ending the while loop.
    Correctness of using break and when not to use break.
    """
    for item in fruit:
        # Asks the user whether they like each fruit
        preference = input("Do you like " + item.lower() + "? yes|no ")
        # Checks to make sure user entered either 'yes' or 'no'
        if preference != 'no' and preference != 'yes':
            # Repeatedly prompts user to enter 'yes' or 'no' until they do.
            while True:
                preference = input("Please answer with either yes or no ")
                if preference == 'yes' or preference == 'no':
                    # Ask about using break instead of False
                    return False
        if preference == 'no':
            # remove item from fruit
            fruit.remove(item)
    print(fruit)


def series4(fruit):
    """
    Take in a list of strings and reverse each letter of each item. Display the
    original list minus the last element and it's copy.
    """
    # Create copy of fruit
    rev_fruit = fruit[:]
    rev_fruit = " ".join(rev_fruit)
    rev_fruit = rev_fruit[::-1]
    rev_fruit = rev_fruit.split()
    rev_fruit.reverse()
    # Delete last item in original list
{'fraction_non_alphanumeric': 0.09538414353626744, 'fraction_numerical': 0.00475387210550529, 'mean_word_length': 2.3601236476043277, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6599731', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1690, 'n_words': 805}