Monday, June 30, 2014

Day 86

Explored Python at CodeCademy. Worked on Python tutorial 4 of 11, PygLatin, Check Yourself! Worked with "if" and "else" commands.

The code used:
print 'Welcome to the Pig Latin Translator!'

original = raw_input("Enter a word:") 

if len(original) > 0:
    print original
    
else:
    print "empty"
    

The interaction for this code looked like this:
Welcome to the Pig Latin Translator!
Enter a word:
empty

also

Welcome to the Pig Latin Translator!
Enter a word: Pig
Pig

Sunday, June 29, 2014

Day 85

Explored Python at CodeCademy. Worked on Python tutorial 3 of 11, PygLatin, Break It Down, Input! Learned about the "input" command.

The code used:
print 'Welcome to the Pig Latin Translator!'
original = raw_input("Enter a word:")

The interaction for this code looked like this:
Welcome to the Pig Latin Translator!
Enter a word: Chicken

Saturday, June 28, 2014

Day 84

Explored Python at CodeCademy. Worked on Python tutorial  1 and 2 of 11, PygLatin, Break It Down, Ahoy! (or Should I Say Ahoyay!)! Learned how I would need to make a Pig Latin translator and utilized the print command to display the name, "Pig Latin."

The code used:
print "Pig Latin"

The interaction for this code looked like this:
Pig Latin

Day 83

Explored Python at CodeCademy. Worked on Python tutorial 15 of 15, Conditionals & Control Flow, The Big If! Finished tutorial, utilizing comparators, boolean operators, and conditional statements.

The code used:
# Make sure that tdef the_flying_circus():
def theflyingcircus():
    if 5 <= 5:    
        return True
        print "It's must be true"    
    elif 6 == 7 or 88 > 99:
        return False 
    else:
        return False

There was no interaction for this code:

Thursday, June 26, 2014

Day 82

Explored Python at CodeCademy. Worked on Python tutorial 14 of 15, Conditionals & Control Flow, I Got 99 Problems, But a Switch Ain't One! Some practice with "Elif" statement.

The code used:
def greater_less_equal_5(answer):
    if 5 < answer: 
        return 1
    elif 5 > answer:          
        return -1
    else:
        return 0
        
print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)

The interaction for this code looked like this:
-1
0
1

Wednesday, June 25, 2014

Day 81

Explored Python at CodeCademy. Worked on Python tutorial 13 of 15, Conditionals & Control Flow, Else Problems, I Feel Bad for You, Son...! Some practice with "else" statement.

The code used:
answer = "'Tis but a scratch!"

def black_knight():
    if answer == "'Tis but a scratch!":
        return True
    else:             
        return False

def french_soldier():
    if answer == "Go away, or I shall taunt you a second time!":
        return True
    else:             
        return False

There was no interaction for this code:

Tuesday, June 24, 2014

Day 80

Explored Python at CodeCademy. Worked on Python tutorial 12 of 15, Conditionals & Control Flow, If You're Having...! Some practice with "if" statements.

The code used:

def using_control_once():
    if True:
        return "Success #1"

def using_control_again():
    if True:
        return "Success #2"

print using_control_once()
print using_control_again()


The interaction for this code looked like this:
Success #1
Success #2

Monday, June 23, 2014

Day 79

Explored Python at CodeCademy. Worked on Python tutorial 11 of 15, Conditionals & Control Flow, Conditional Statement Syntax! Learned some more about the "if" is conditional statement.

The code used:
response = 'Y'
answer = "Left"
if answer == "Left":
print "This is the Verbal Abuse Room, you heap of parrot droppings!"

The interaction for this code looked like this:
This is the Verbal Abuse Room, you heap of parrot droppings!

Sunday, June 22, 2014

Day 78

Explored Python at CodeCademy. Worked on Python tutorial 10 of 15, Conditionals & Control Flow, Mix 'n' Match! Use boolean expressions as appropriate on the lines in the tutorial.

The code used:
# Make me false!
bool_one = (2 <= 2) and "Alpha" == "Bravo" # We did this one for you!
# Make me true!
bool_two = not 3**4 < 4**3
# Make me false!
bool_three = 19 % 4 != 300 / 10 / 10 and False
# Make me true!
bool_four = True and True
# Make me true!
bool_five = True or True

There was no interaction for this code:

Saturday, June 21, 2014

Day 77

Explored Python at CodeCademy. Worked on Python tutorial 9 of 15, Conditionals & Control Flow, This and That (or This, But Not That! Learned about the order of operations for boolean operators.

The code used:
bool_one = False or not True and True
bool_two = False and not True or True
bool_three = True and not (False or False)
bool_four = not not True or False and not True
bool_five = False or not (True and True)

There was no interaction for this code:

Friday, June 20, 2014

Day 76

Explored Python at CodeCademy. Worked on Python tutorial 8 of 15, Conditionals & Control Flow, Not! Learned about the boolean operator "Not."

The code used:
bool_one = not True
bool_two = not 3**4 < 4**3
bool_three = not 10 % 3 <= 10 % 2
bool_four = not 3**2 + 4**2 != 5**2
bool_five = not not False

There was no interaction for this code:

Thursday, June 19, 2014

Day 75

Explored Python at CodeCademy. Worked on Python tutorial 7 of 15, Conditionals & Control Flow, Or! Learned about the boolean operator "or."

The code used:
bool_one = 2**3 == 108 % 100 or 'Cleese' == 'King Arthur'
bool_two = True or False
bool_three = 100**0.5 >= 50 or False
bool_four = True or True
bool_five = 1**100 == 100**1 or 3 * 2 * 1 != 3 + 2 + 1

There was no interaction for this code:

Wednesday, June 18, 2014

Day 74

Explored Python at CodeCademy. Worked on Python tutorial 6 of 15, Conditionals & Control Flow, And! Learned about the boolean operator "and" and how it returns "True" when the expressions on either side of "and" are true.

The code used:
bool_one = False and False
bool_two = -(-(-(-2))) == -2 and 4 >= 16**0.5
bool_three = 19 % 4 != 300 / 10 / 10 and False
bool_four = -(1**2) < 2**0 and 10 % 10 <= 20 - 10 * 2
bool_five = True and True

There was no interaction for this code:

Day 73

Explored Python at CodeCademy. Worked on Python tutorial 5 of 15, Conditionals & Control Flow, To Be and/or Not to Be! Learned about comparing statements and result in boolean values.

The code used:
"""
Boolean Operators
---------------------------
True and True is True
True and False is False
False and True is False
False and False is False

True or True is True
True or False is True
False or True is True
False or False is False

Not True is False
Not False is True
"""

There was no interaction for this code:

Monday, June 16, 2014

Day 72

Explored Python at CodeCademy. Worked on Python tutorial 4 of 15, Conditionals & Control Flow, How the Tables Have Turned! Learned about booleans, and expressions.

The code used:
# Make me true!
bool_one = 3 < 5 # We already did this one for you!
# Make me false!
bool_two = 3 == 5
# Make me true!
bool_three = 3 < 5
# Make me false!
bool_four = 7 > 8
# Make me true!
bool_five = 3 >= 3

There was no interaction for this code:

Sunday, June 15, 2014

Day 71

Explored Python at CodeCademy. Worked on Python tutorial 3 of 15, Conditionals & Control Flow, Compare... Closelier! Learned about extreme expressions and comparators.

The code used:
# Assign True or False as appropriate on the lines below!
# (20 - 10) > 15
bool_one = False # We did this one for you!
# (10 + 17) == 3**16
# Remember that ** can be read as 'to the power of'. 3**16 is about 43 million.
bool_two = False
# 1**2 <= -1
bool_three = False
# 40 * 4 >= -4
bool_four = True
# 100 != 10**2
bool_five = False

There was no interaction for this code:

Saturday, June 14, 2014

Day 70

Explored Python at CodeCademy. Worked on Python tutorial 2 of 15, Conditionals & Control Flow, Compare Closely! Learned about control flow: comparators.

The code used:
# Assign True or False as appropriate on the lines below!
# Set this to True if 17 < 328 or to False if it is not.
bool_one = True # We did this one for you!
# Set this to True if 100 == (2 * 50) or to False otherwise.
bool_two = True
# Set this to True if 19 <= 19 or to False if it is not.
bool_three = True
# Set this to True if -22 >= -18 or to False if it is not.
bool_four = False
# Set this to True if 99 != (98 + 1) or to False otherwise.
bool_five = False

There was no interaction for this code:

Friday, June 13, 2014

Day 69

Explored Python at CodeCademy. Worked on Python tutorial 1 of 15, Conditionals & Control Flow, Go With the Flow. Examined the type of program I'll be able to write once I've mastered control flow.

The code used:
def clinic():
print "You've just entered the clinic!"
print "Do you take the door on the left or the right?"
answer = raw_input("Type left or right and hit 'Enter'.").lower()
if answer == "left" or answer == "l":
print "This is the Verbal Abuse Room, you heap of parrot droppings!"
elif answer == "right" or answer == "r":
print "Of course this is the Argument Room, I've told you that already!"
else:
print "You didn't pick left or right! Try again."
clinic()
clinic()

The interaction looked like this:
You've just entered the clinic!
Do you take the door on the left or the right?
Type left or right and hit 'Enter'. left
This is the Verbal Abuse Room, you heap of parrot droppings!

Thursday, June 12, 2014

Day 68

Explored Python at CodeCademy. Worked on Python tutorial 6 of 6, Date and Time, Grand Finale. Finished course by printing the date and time separately in a specific format.

The code used:
from datetime import datetime
now = datetime.now()
print '%s/%s/%s %s:%s:%s' % (now.month, now.day, now.year, now.hour, now.minute, now.second)

The interaction looked like this:
6/13/2014 2:32:25

Wednesday, June 11, 2014

Day 67

Explored Python at CodeCademy. Worked on Python tutorial 5 of 6, Date and Time, Pretty Time. Learned how to print time in a specific format.

The code used:
from datetime import datetime
now = datetime.now()
print '%s:%s:%s' % (now.hour, now.minute, now.second)

The interaction looked like this:
3:43:4

Tuesday, June 10, 2014

Day 66

Explored Python at CodeCademy. Worked on Python tutorial 4 of 6, Date and Time, Hot Date. Learned how to print date in a specific format.

The code used:
from datetime import datetime
now = datetime.now()
print '%s/%s/%s' % (now.month, now.day, now.year)

The interaction looked like this:
6/11/2014

Monday, June 9, 2014

Day 65

Explored Python at CodeCademy. Worked on Python tutorial 3 of 6, Date and Time, Extracting Information. Learned how to print individual parts of the date and time instead of the entire thing.

The code used:
from datetime import datetime
now = datetime.now()
print now.year
print now.month
print now.day

The interaction looked like this:
2014
6
9

Sunday, June 8, 2014

Day 64

Explored Python at CodeCademy. Worked on Python tutorial 2 of 6, Date and Time, Getting the Current Date and Time. Learned to use a function called datetime.now() to retrieve the current date and time.

The code used:
from datetime import datetime
now = datetime.now()
print now

The interaction looked like this:
2014-06-08 20:32:22.541607

Saturday, June 7, 2014

Day 63

Explored Python at CodeCademy. Worked on Python tutorial 16 of 16, Strings & Console Output, And Now, For Something Completely Familiar. Refresh on three ways to create strings, string methods, printing a string, advanced printing techniques.

The code used:
my_variable = "Alfa"
print len(my_variable) 
print my_variable.upper()

The interaction looked like this:
4
ALFA

Friday, June 6, 2014

Day 62

Explored Python at CodeCademy. Worked on Python tutorial 15 of 16, Strings & Console Output, String Formatting with %, Part 2. Learned more on how to print a variable with a string without concatenating strings together.

The code used:
name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")
print "Ah, so your name is %s, your quest is %s, " \
"and your favorite color is %s." % (name, quest, color)

The interaction looked like this:
What is your name? Gandalf
What is your quest? Gray to White
What is your favorite color? Red
Ah, so your name is Gandalf, your quest is Gray to White, and your favorite color is Red.

Thursday, June 5, 2014

Day 61

Explored Python at CodeCademy. Worked on Python tutorial 14 of 16, Strings & Console Output, String Formatting with %, Part 1. Learned how to print a variable with a string without concatenating strings together.

The code used:
string_1 = "Camelot"
string_2 = "place"
print "Let's not go to %s. 'Tis a silly %s." % (string_1, string_2)

The interaction looked like this:
Let's not go to Camelot. 'Tis a silly place.

Wednesday, June 4, 2014

Day 60

Explored Python at CodeCademy. Worked on Python tutorial 13 of 16, Strings & Console Output, Explicit String Conversion. Learned how to combine a string with something that isn't a string.

The code used:
# Turn 3.14 into a string
print "The value of pi is around " + str(3.14)

The interaction looked like this:
The value of pi is around 3.14

Tuesday, June 3, 2014

Day 59

Explored Python at CodeCademy. Worked on Python tutorial 12 of 16, Strings & Console Output, String Concatenation. Learned how to concatenate a few strings together.

The code used:
print "Spam " + "and " + "eggs"

The interaction looked like this:
Spam and eggs

Monday, June 2, 2014

Day 58

Explored Python at CodeCademy. Worked on Python tutorial 11 of 16, Strings & Console Output, Printing Variables. Learned how to print variables.

The code used:
the_machine_goes = "Ping!"
print the_machine_goes

The interaction looked like this:
Ping!

Day 57

Explored Python at CodeCademy. Worked on Python tutorial 10 of 16, Strings & Console Output, Printing Strings. Learned that the editor is where the code is typed and the console is where the code is displayed.

The code used:
print "Monty Python"

The interaction looked like this:
Monty Python

Day 56

Explored Python at CodeCademy. Worked on Python tutorial 9 of 16, Strings & Console Output, Dot Notation. Learned about how dot notation works only with strings, while len() and str() work with other data types.

The code used:
ministry = "The Ministry of Silly Walks"
print len(ministry)
print ministry.upper()

The interaction looked like this:
THE MINISTRY OF SILLY WALKS

Day 55

Explored Python at CodeCademy. Worked on Python tutorial 8 of 16, Strings & Console Output, str(). Learned how to use str().

The code used:
pi = 3.14
print str(pi)

The interaction looked like this:
3.14

Day 54

Explored Python at CodeCademy. Worked on Python tutorial 7 of 16, Strings & Console Output, upper(). Learned how to use upper().

The code used:
parrot = "norwegian blue"
print parrot.upper()

The interaction looked like this:
NORWEGIAN BLUE