<repo_name>Baranax/Python-Practice<file_sep>/notes.py
"""
Name       :<NAME>
Title      :index.py
Version    :1.0.1
Copyright  :ALL RIGHTS RESERVED
Description:Main Python module for project
"""

# function definitions


def user_list():
    print('--Main menu--')
    print('"load" - opens a previous stack (if applicable)')
    print('"add" - adds a note to the notes stack')
    print('"print" - prints all notes currently in stack')
    print('"insert" - inserts a note at selected location')
    print('"remove" - removes a note at selected location')
    print('"save" - saves notes to persistent file')
    print('"export" - exports notes to xml file')
    print('"quit" - exits the program safely')


def user_add():
    note_input = str(input('Type "single" or "multiple": '))
    if note_input == 'single':
        new_note = str(input('Note to be added: '))
        userNotes.append(new_note)
        print('Note added successfully!')
    elif note_input == 'multiple':
        while note_input != 'DONE':
            new_note = str(input('Note to be added (type DONE to finish adding notes): '))
            userNotes.append(new_note)
            print('Note added successfully!')
            if new_note == 'DONE':
                note_input = new_note


def user_print():
    print('Current list of notes:')
    print(*userNotes, sep='\n')


def user_insert():
    note_location = int(input('Location of new note: '))
    new_note = str(input('Note to be added: '))
    userNotes.insert(note_location, new_note)
    print('Note added successfully at %d!' % note_location)


def user_remove():
    note_location = int(input('Location of note: '))
    userNotes.pop(note_location)
    print('Note deleted successfully at %d!' % note_location)


def user_save():
    print('WARNING! MODULE UNDER CONSTRUCTION!')
    index = open('index.txt', 'w')
    index.writelines("%s\n" % item for item in userNotes)


# variable declaration
userNotes = []

# init program
print('Program is now running...')
print('\nNotes program - type "list" for a list of commands')
userInput = str(input('Option: '))

while userInput != 'quit':
    if userInput == 'list':
        user_list()
    elif userInput == 'load':
        print('Module not yet complete!')
    elif userInput == 'add':
        user_add()
    elif userInput == 'print':
        user_print()
    elif userInput == 'insert':
        user_insert()
    elif userInput == 'remove':
        user_remove()
    elif userInput == 'save':
        user_save()
    elif userInput == 'export':
        print('Module not yet implemented!')
    else:
        print('INVALID OPTION!')
    userInput = str(input('Option: '))
print('Good Bye!')
<file_sep>/AreaCalculator.py
from math import pi
from time import sleep
from datetime import datetime

now = datetime.now()

print "Calculator is now running..."

print "Current time:%s/%s/%s/%s:%s" % (now.month, now.day, now.year, now.hour, now.minute)

sleep(1)

hint = "Don't forget to include the correct unit!"

option = raw_input("Enter C for Circle or T for Triangle:")
option = option.upper()

#check if shape is circle or triangle and evaluate area
if option == 'C':
    radius = float(raw_input("Input radius: "))
    area = pi * (radius**2)
    print "The pie is baking..."
    sleep(1)
    print ("Area: %.2f. \n%s" % (area, hint))
elif option == 'T':
    base = float(raw_input("Input base: "))
    height = float(raw_input("Input height: "))
    area = base * height * (.5)
    print "Uni Bi Tri..."
    sleep(1)
    print ("Area: %.2f \n%s" % (area, hint))
else:
    print "Input incorrect.  Program will now Exit..."
<file_sep>/nameandage.py
#A simple program to determine someone's name and age and then calculate when they will become 100 years old

print "Name and Age Calculator is now running"

name = "What is your name: "
age = "How old are you (in years): "
year = str((2016 - age) + 100)
print(name + " will be 100 years old in the year " + year)
<file_sep>/README.md
# Python-Practice
# This is how we do things around here
<file_sep>/Madlibs.py
## This program was made to take a list of adjectives from the user and add it to the pre-defined story below

print "Mad Libs is now running"

char_name = raw_input("Please type a name ")

adj1 = raw_input("adjective 1 ")
adj2 = raw_input("adjective 2 ")
adj3 = raw_input("adjective 3 ")

verb1 = raw_input("verb 1 ")
verb2 = raw_input("verb 2 ")
verb3 = raw_input("verb 3 ")

noun1 = raw_input("noun 1 ")
noun2 = raw_input("noun 2 ")
noun3 = raw_input("noun 3 ")
noun4 = raw_input("noun 4 ")

animal = raw_input("animal ")
food = raw_input("food ")
fruit = raw_input("fruit ")
number = raw_input("number ")
superhero_name = raw_input("Superhero Name ")
country = raw_input("country ")
dessert = raw_input("dessert ")
year = raw_input("year ")

#The template for the story
STORY = "This morning I woke up and felt %s because %s was going to finally %s over the big %s %s. On the other side of the %s were many %ss protesting to keep %s in stores. The crowd began to %s to the rythym of the %s, which made all of the %ss very %s. %s tried to %s into the sewers and found %s rats. Needing help, %s quickly called %s. %s appeared and saved %s by flying to %s and dropping %s into a puddle of %s. %s then fell asleep and woke up in the year %s, in a world where %ss ruled the world."

print STORY % (adj1, char_name, verb1, adj2, noun1, noun2, animal, food, verb2, noun3, fruit, adj3, char_name, verb3, number, char_name, superhero_name, superhero_name, char_name, country, char_name, dessert, char_name, year, noun4)
