def getFlavors():
    l = []
    l.append(Epic.userString("Enter Flavor 1:"))
    l.append(Epic.userString("Enter Flavor 2:"))
    l.append(Epic.userString("Enter Flavor 3:"))
    l.append(Epic.userString("Enter Flavor 4:"))
    l.append(Epic.userString("Enter Flavor 5:"))
    return l
Example #2
0
def placeBet(cash):
    bet = Epic.userInt("How much would do you want to bet? (cash: $%s) " %
                       cash)

    while bet > cash:
        print "You don't have that much money!"
        bet = Epic.userInt("How much would do you want to bet? (cash: $%s) " %
                           cash)

    return bet
Example #3
0
def main():
    print "Let's check the weather!"
    loop = "y"

    while loop != "n":
        location = Epic.userString(
            "Where do you want to check? (enter a location or a zip code)")

        weatherJSON = getJSON(location)
        printWeather(weatherJSON)

        loop = Epic.userString("Do you want to check another location? (y/n)")

    print "Enjoy the weather!"
Example #4
0
def main():
    tempList = readTemps()

    percentage = Epic.userFloat(
        "Enter a percentage of how you'd like the data split: ")

    # Calculating percentage based on user input
    start = 0
    percentage = percentage / 100
    stop = int(len(tempList) * percentage)

    first_average = calculateAvg(tempList, start, stop)
    first_count = count(tempList, start, stop)

    print(
        "\nDuring the first %s years, the average deviation from the temperature anomoly is %s."
    ) % (stop, first_average)
    print("During the first %s years, %s had a positive temperature anomoly."
          ) % (stop, first_count)

    # Starting where first list had left off
    start = stop
    stop = len(tempList)

    second_average = calculateAvg(tempList, start, stop)
    second_count = count(tempList, start, stop)

    print(
        "During the last %s years, the average deviation from the temperature anomoly is %s."
    ) % ((stop - start), second_average)
    print("During the last %s years, %s had a positive temperature anomoly."
          ) % ((stop - start), second_count)
Example #5
0
def printWeather(JSON):
    country = JSON["location"]["country"]
    if country == "Canada":
        tempType = Epic.userString(
            "Do you want to use Celsius(c) or Fahrenheit(f)?")
    print "Here is the weather for %s, %s (%s)" % (JSON["location"]["name"],
                                                   JSON["location"]["region"],
                                                   JSON["location"]["country"])
    if country == "USA" or country == "United States of America" or country == "Bahamas" or country == "Belize" or country == "Palau" or country == "Cayman Islands" or country == "Puerto Rico" or country == "Guam":
        print "\t%s and %s degrees (F)" % (
            JSON["current"]["condition"]["text"], JSON["current"]["temp_f"])
        print "\tIt actually feels like %s degrees (F) outside." % (
            JSON["current"]["feelslike_f"])
    elif country == "Canada" and tempType == "c":
        print "\t%s and %s degrees (C)" % (
            JSON["current"]["condition"]["text"], JSON["current"]["temp_c"])
        print "\tIt actually feels like %s degrees (C) outside." % (
            JSON["current"]["feelslike_c"])
    elif country == "Canada" and tempType == "f":
        print "\t%s and %s degrees (F)" % (
            JSON["current"]["condition"]["text"], JSON["current"]["temp_f"])
        print "\tIt actually feels like %s degrees (F) outside." % (
            JSON["current"]["feelslike_f"])
    else:
        print "\t%s and %s degrees (C)" % (
            JSON["current"]["condition"]["text"], JSON["current"]["temp_c"])
        print "\tIt actually feels like %s degrees (C) outside." % (
            JSON["current"]["feelslike_c"])

    print ""
Example #6
0
def main():
    answer = ""
    eater1 = 0
    eater2 = 0
    eater3 = 0

    guess = Epic.userStr("Pick a winner (Tom, Sally, or Fred):")
    print "Ready.. Set.. Eat!"

    while answer == "":  # connects back to winner function
        eater1 = eater1 + random.randrange(1, 6)
        eater2 = eater2 + random.randrange(1, 6)
        eater3 = eater3 + random.randrange(1, 6)
        print
        for x in range(
                0,
                3):  # print this 3x instead of printing each one word for word
            print "chomp..",
        print
        time.sleep(1)  # let 2 secs pass between.
        print
        print "Tom has eaten %s hot dogs." % eater1
        print "Sally has eaten %s hot dogs." % eater2
        print "Fred has eaten %s hot dogs." % eater3
        answer = winner(eater1, eater2, eater3)

    print_winner(guess, answer)
Example #7
0
def main():
    ans = random.randrange(1, 11)
    keepGoing = True
    while keepGoing:
        guess = Epic.userInt("Enter a guess from 1 to 10:")
        if guess == ans:
            print "You win!"
            keepGoing = False
Example #8
0
def main():
    keepGoing = True
    while keepGoing:
        msg = Epic.userString("Enter a message (enter 'quit' to exit):")
        if msg == "quit":
            keepGoing = False
        else:
            print msg
Example #9
0
def main():
    d = build_deck(rank, suit)

    times = Epic.userInt(
        "How many times would you like the deck to be shuffled?:")

    for i in range(0, times):
        d = shuffle(d)
    print deal(d)
Example #10
0
def main():
    deck = buildDeck(rank, suit)
    number = Epic.userInt("How many times do you want to shuffle? ")

    for i in range(0, number):
        deck = shuffle(deck)

    deck = deal(deck)

    print deck
Example #11
0
def main():
    jsonTxt = ""
    f = open('contacts.json')
    for line in f:
        line = line.strip()
        jsonTxt = jsonTxt + line
    contacts = json.loads(jsonTxt)

    name = Epic.userString("Enter a name:")
    for contact in contacts:
        if contact["Name"] == name:
            print "%s" % contact["Phone"]
            for email in contact["Email"]:
                print email
Example #12
0
def askUser():
    d = {}
    for line in open("birds.txt"):
        temp = line.split(",")
        bird = temp[0].strip()
        sightings = int(temp[1].strip())
        if bird in d:
            d[bird] = d[bird] + sightings
        else:
            d[bird] = sightings

    bird = Epic.userStr("Enter a bird name:")
    if bird in d:
        return d[bird]
Example #13
0
def main():
    numGuesses = 0
    ans = random.randrange(1, 11)
    keepGoing = True
    while keepGoing:
        guess = Epic.userInt("Enter a guess from 1 to 10:")
        numGuesses = numGuesses + 1
        if guess == ans:
            print "You win! It took %s guesses." % numGuesses
            keepGoing = False
        else:
            if (guess > ans):
                print "You guessed too high!"
            else:
                print "You guessed too low!"
Example #14
0
def searchFile(cardList, deck):
    for decks in cardList:
        if decks["Name"] == deck:
            category = Epic.userString(
                "What do you want to look at? (\"Monster\", \"Spell\", \"Trap\", \"Extra\")"
            )
            if category != "Monster" and category != "Spell" and category != "Trap" and category != "Extra":
                print "Please enter a valid category"
            else:
                print "\n**********************************************************************************************************************************************"
                print "Here are all the %s cards in your %s deck" % (
                    category.lower(), deck)
                print "================================================================"
                for card in decks[category]:
                    print "- %s" % card
                print "**********************************************************************************************************************************************\n"
def main():
    good_prizes = ["New Car!", "$100", "A Badge in Pyhton Class", "A free A in python!"]
    bad_prizes = ["An Old Sock", "A Smelly Garbage Can", "A Sore Throat", "More Homework"]
    doors = ['', '', '']
#place random bad prizes between all 3 doors    
    random.shuffle(bad_prizes)
    doors[0] = bad_prizes[0]
    doors[1] = bad_prizes[1]
    doors[2] = bad_prizes[2]
#replace random bazd prize with good one    
    random.shuffle(good_prizes)
    iGoodPrize = random.randrange(0,3)
    doors[iGoodPrize] = good_prizes[0]
#let user pick door    
    door = Epic.userInt("Pick a door:")
    print "You win..."
    time.sleep(5)
    print "You win a %s" % doors[door-1]
Example #16
0
def main():
    cardList = readFile('cards.json')

    print "**********************************************************************************************************************************************"
    print "Welcome to CardSearch. We keep track of your current decks and provide an easy way to search through your decks."
    print "Here is a list of your current decks:"
    for deck in cardList:
        print deck["Name"]
    print "**********************************************************************************************************************************************\n"
    loop = True

    while loop == True:
        deck = Epic.userString(
            "Which Deck do you wish to look at? (q to quit)")
        if deck == "q":
            loop = False
        else:
            searchFile(cardList, deck)

    print "Thank you for using CardSearch. Happy Dueling."
def main():
    # initialize prizes...
    good_prizes = ["New Car!", "$100", "Badge in Python Class", "Free A in Python!"]
    bad_prizes = ["Old Sock", "Smelly Garbage Can", "Sore Throat", "More Homework"]
    
    # create a list for the doors...
    doors = ["", "", ""]

    # place radom bad prizes in behind all three doors...
    random.shuffle(bad_prizes)
    doors[0] = bad_prizes[0]
    doors[1] = bad_prizes[1]
    doors[2] = bad_prizes[2]
    
    # replace a random bad prize with a good one...
    random.shuffle(good_prizes)
    iGoodPrize = random.randrange(0,3)
    doors[iGoodPrize] = good_prizes[0]
    
    # let the user pick a door
    door = Epic.userInt("Pick a door:")
    print "You win..."
    time.sleep(5)
    print "...a %s" % doors[door-1]
Example #18
0
import Epic

d = {}
for line in open("DictionaryGrades.txt"):
    temp = line.split(":")
    name = temp[0].strip()
    grades = temp[1].split(",")
    for index in range(0, len(grades)):
        grades[index] = grades[index].strip()
    d[name] = grades

n = Epic.userString("Enter a name:")
if n in d:
    print d[n]
else:
    print "%s is not in the file." % n
Example #19
0
def main():
    word = Epic.userStr("Enter word here:")
    dictionary = findWord(word)
    printWord(dictionary)
Example #20
0
import Epic

sentence = (
    "In the shadowy world of spies, a/an ADJ1 organization like the US "
    "Government uses spies to infiltrate ADJ2 groups for the purpose of "
    "obtaining top secret PLNOUN1.  A teacher, CELEB, or even the little "
    "old NOUN with a cane and fifteen pet PLNOUN2 could be a spy.")

adj1 = Epic.userString("Enter an adjective:")
adj2 = Epic.userString("Enter another adjective:")
plNoun1 = Epic.userString("Enter a plural noun:")
plNoun2 = Epic.userString("Enter another plural noun:")
celeb = Epic.userString("Enter a celebrity:")
noun = Epic.userString("Enter a noun:")
print
sentence = sentence.replace("ADJ1", adj1)
sentence = sentence.replace("ADJ2", adj2)
sentence = sentence.replace("PLNOUN1", plNoun1)
sentence = sentence.replace("PLNOUN2", plNoun2)
sentence = sentence.replace("CELEB", celeb)
sentence = sentence.replace("NOUN", noun)

print sentence
Example #21
0
import Epic

sentence = Epic.userStr("Please enter a sentence:")
words = sentence.split(' ')
lgWords = []
smWords = []

for word in words:
    if len(word) > 3:
        lgWords.append(word)
    else:
        smWords.append(word)

print words
print
print smWords
print
print lgWords
Example #22
0
# Song Creator
# A program to asist user in constructing a song
# By Tim Murphy 15/7/17

import Epic

verseNum = ["first", "second", "third", "fourth"]
verseList = []

# Acquiring submissions of each verse from user and adding to list
for verse in verseNum:
    userVerses = Epic.userString("Enter your %s verse:" % verse)
    verseList.append(userVerses)

chorus = Epic.userString("Enter your chorus:")
repeat = Epic.userInt("Enter your repeat amount:")

fullChorus = (chorus + "") * repeat
lastChorus = fullChorus + chorus

# Pairing choruses with each verse
verseList.insert(1, fullChorus)
verseList.insert(3, fullChorus)
verseList.insert(5, fullChorus)
verseList.insert(7, lastChorus)
verseList.insert(8, "One More Time Now!")

song = verseList * 2
del song[17]

print song
Example #23
0
import Epic
#compile acquired bird data
d = {}
for line in open("Birds.txt"):
    temp = line.split(",")
    bird = temp[0].strip()
    timeSeen = int(temp[1]).strip())
#
    for index in range(0, len(grades)):
        grades[index] = grades[index].strip()
    d[name] = grades
#known bird data with range    
bird = ['Cardinal', 'House Sparrow', 'House Wren', 'Robin', 'House Finch', 'Starling', 'Downy Woodpecker', 'American Crow', 'Blue Jay', 'Song Sparrow']
for i in range(1, 4):
    print l
    [i]
    
#fetch obtainable bird data    
for line in open('test.txt'):
    temp = line.split(',')
    name = temp[0].strip()
    age = temp[1].strip()
    print name
    print age
    
#user retrieves desired bird data    
n = Epic.userString("Please enter a bird:")
if bird in d:
    print d[]
else:
    print "I have not seen that bird."
Example #24
0
import Epic
import json
import urllib2

abbr = Epic.userString("Please enter a abbreviation:")
url = 'http://www.nactem.ac.uk/software/acromine/dictionary.py?sf=' + abbr
jsonTxt = urllib2.urlopen(url).read()
acromine = json.loads(jsonTxt)

if len(acromine) == 0:
    print "No results"
else:
    print acromine[0]['sf']
    for ans in acromine[0]['lfs']:
        print ans['lf']
Example #25
0
def userInput():
    guess = Epic.userString("Pick a winner (Joey, Miki, or Matthew): ")
    return guess.lower()
Example #26
0
import Epic

ratings = []
flavors = ["vanilla", "chocolate", "strawberry", "bacon"]
for flavor in flavors:
    rating = Epic.userString("Rate %s from 1 to 5:" % flavor)
    ratings.append("%s rated as a %s" % (flavor, rating))
print ratings
import Epic

song = []

verse1 = Epic.userStr("Enter the first verse here:")
verse2 = Epic.userStr("Enter the second verse here:")
verse3 = Epic.userStr("Enter the third verse here:")
verse4 = Epic.userStr("Enter the fourth verse here:")

chorus = Epic.userStr("Enter the chorus:")
chorusrep = Epic.userInt("Enter the chourus repeat:")
print

v = [verse1, verse2, verse3, verse4]
for x in v:
    song.append(x)
    song.append(chorus * chorusrep)
song.append(chorus)

song = (song * 2)
song.insert(8, "...one more time!...")

print song
print

for line in song:
    print line
Example #28
0
def main():
    l = Epic.userList("Enter three numbers, each spearated by a commas:")
    for n in l:
        for i in range(0, int(n)):
            print n,
        print
Example #29
0
def askUserForLetter():
    l = Epic.userString("Please select a letter:")
    return l
Example #30
0
import Epic

band = Epic.userString("Enter the band you want to follow:")
file = open('concerts.txt')

for line in file:
    if band in line:
        print line,

print "\nHave fun and wear your ear plugs!"