Thursday, June 13, 2013

Lesson 6 : List & Dictionaries "Grocery Store Project"

It was very good again for today's lesson.


"""
Learning Python
Lesson 6 : List & Dictionaries
Grocery Store Project

Simple programming exercises from Codecademy
"""


# Exercise 0 : Shopping at the Market
"""
    First, make a list (not a dictionary!) with the name groceries.
    Insert a "banana", "orange", and "apple".
"""
groceries = {"banana", "orange", "apple", "egg", "bread"}



# Exercise 1 : Making a Purchase
"""
    Write a function compute_bill that takes an argument food as input
    and computes your bill by looping through your food list and adding
    the costs of each item in the list.

    If an item on your food list is not in stock, don't worry about it for now.
"""

stock = {
    "banana": 6,
    "apple": 2,
    "orange": 32,
    "pear": 15,
    "egg": 10,
    "bread": 15
}
   
prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3,
    "bread": 15,
    "egg": 10
}

# Write your code below!
def compute_bill(food):
    total = 0
    for item in food:
        if stock[item] > 0:
          total = total + prices[item]
          stock[item] = stock[item] - 1
    return total

print compute_bill(groceries)


Python 2.7.3 (default, Apr 20 2012, 22:44:07)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>>
set(['orange', 'apple', 'banana'])

5.5
>>>
30.5
>>>
32.5
>>>

Tuesday, June 11, 2013

Grocery Store Project

As you go deep in programing, it become very hard or harder.
This project, going through or learning it was very difficult for me but with the help of your able Instructor "Zane Cochran", I was able to learned it.
These are few codes below.
"""
Learning Python
Lesson 6 : List & Dictionaries

Simple programming exercises from Codecademy
"""


# Exercise 0 : BeFOR We Begin
"""
    Use a for loop to print out all of the elements in the list names.
"""

names = ["Adam","Alex","Mariah","Martine","Columbus"]

for word in names:
    print word

   
# Exercise 1 : This is KEY!
"""
    Use a for loop to go through the webster dictionary
    and print out all of the definitions.
"""

webster = {
    "Aardvark" : "A star of a popular children's cartoon show.",
    "Baa" : "The sound a goat makes.",
    "Carpet": "Goes on the floor.",
    "Dab": "A small amount."
}
for word in webster:
    print webster[word]

# Exercise 2 : Control Flow and Looping
"""
    Loop through list a and only print out the even numbers.
"""
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

for allnumbers in a:
    if allnumbers %2 == 0:
       print allnumbers
   
# Exercise 3 : Lists & Functions
"""
    Write a function called fizz_count that takes a list x
    as input and returns the count of the string "fizz" in
    that lise. For example,

    fizz_count(["fizz", "buzz", "fizz"]) should return 2.

    Then give your fizz_count the argument sample and see what it returns:
    print fizz_count(sample)
   
"""
sample = ["fizz", "buzz", "fizz", "buzz", "fizz", "fizz", "fizz"]


def fizz_count(x):
    count = 0
    for item in x:
        if item == "fizz":
            count = count+1
           
    return count
              
print fizz_count(sample)



Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
5
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12

"""
Learning Python
Lesson 6 : List & Dictionaries
Grocery Store Project

Simple programming exercises from Codecademy
"""


# Exercise 0 : Your Own Store!
"""
    Create a dictionary called prices
    Give it the following key/value pairs:

    "banana": 4
    "apple": 2
    "orange": 1.5
    "pear": 3
"""
prices = {"banana":4, "apple":2, "orange":1.5, "pear":3}


# Exercise 1 : Investing in Stock
"""
    Create a dictionary called stock
    Give it the following key/value pairs:

    "banana": 6
    "apple": 0
    "orange": 32
    "pear": 15
"""
stock = {"banana":6, "apple":0, "orange":32, "pear":15}




# Exercise 2 : Keeping Track of the Produce 
"""
    Use a for loop to print out information about every item in your store

    Print the answer in the following format:

    item
    "price: x"
    "stock: x"

    So when you print out the data for apples, print out:

    apple
    price: 2
    stock: 0

    Each of these values should be in a different print statement.
    Remember to convert numbers to strings before trying to combine them.
"""
for item in stock:
    print item
    print "price: %s" % prices[item]
    print "stock: %s" % stock [item]
   

# Exercise 3 : Something of Value  
"""
    Use a for loop to determine how much money you would make
    if you sold all the food you had in stock.

    Print out the result.
"""
total=0
for item in stock:
    sales = prices[item]* stock[item]
    total = total + sales
   
print total

Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
fizz
buzz
fizz
buzz
fizz
fizz
fizz
None
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
5
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
1
2
3
4
5
5
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
fizz
fizz
fizz
fizz
fizz
5
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
5
>>>
>>>
orange
pear
banana
apple

orange
1.5
32
pear
3
15
banana
4
6
apple
2
0
>>>
orange
price: 1.5
stock: 32
pear
price: 3
stock: 15
banana
price: 4
stock: 6
apple
price: 2
stock: 0

>>>
orange
price: 1.5
stock: 32
pear
price: 3
stock: 15
banana
price: 4
stock: 6
apple
price: 2
stock: 0
117.0
>

Thursday, June 6, 2013

Lesson 6 Dictionaries

Lesson 6 Dictionaries was very good for today.
I am very happy to have learned Dictionaries in Python Programing at this great institute/organization ILabLiberia.
Prof Zane was good to us in this class.
Below are some practice of this lesson.
"""
Learning Python
Lesson 6 : List & Dictionaries
Dictionaries

Simple programming exercises from Codecademy
"""


# Exercise 0 : This Next Part is Key
"""
    Print the value stored under the 'Sloth' key
    Print the value stored under the 'Burmese Python' key.
"""
residents = {'Puffin' : 104, 'Sloth' : 105, 'Burmese Python' : 106}


# Print the value stored under the 'Sloth' key
print residents ["Sloth"]



# Print the value stored under the 'Burmese Python' key
print residents ["Burmese Python"]






# Exercise 1 : New Entries
"""
    Add at least three key-value pairs to the menu variable,
    with the dish name (as a "string") for the key and the
    price (a float or integer) as the value. Here's an example:

    menu['Rice'] = 2.50
"""

menu = {}
menu['Chicken'] = 14.50


# Add three dish-price pairs to menu!
menu['Fish'] = 10.50
menu['Pizza'] = 17.50
menu['Rosted Meat'] = 10.99
print menu






# Now print the menu to see the new items





# Exercise 2 : Changing Your Mind
"""
    Delete the 'Sloth' and 'Bengal Tiger'
    items from zoo_animals using del.

    Set the value associated with 'Rockhopper Penguin'
    to anything other than 'Arctic Exhibit'.
"""

# key - animal_name : value - location
zoo_animals = { 'Unicorn' : 'Cotton Candy House',
'Sloth' : 'Rainforest Exhibit',
'Bengal Tiger' : 'Jungle House',
'Atlantic Puffin' : 'Arctic Exhibit',
'Rockhopper Penguin' : 'Arctic Exhibit'}

del(zoo_animals['Unicorn'])

print zoo_animals



# Delete the 'Sloth' and 'Bengal Tiger' items from zoo_animals using del.
del (zoo_animals ['Sloth'])

del (zoo_animals ['Bengal Tiger'])

print zoo_animals



# Set the value associated with 'Rockhopper Penguin' to something else.
zoo_animals ['Rockhopper Penguin'] = 'Lion Dane'


# Now print this zoo_animals dictionary
print zoo_animals

Answers below
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>>
105
106
>>>
105
106
>>>
105
106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
>>>
105
106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
>>>
105
106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
Traceback (most recent call last):
  File "/home/ilab-1/Downloads/Lesson6-Dictionaries.py", line 86, in <module>
    print zoo_animal

106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Arctic Exhibit'}
>>>
105
106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
{'Bengal Tiger': 'Jungle House', 'Sloth': 'Rainforest Exhibit', 'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Arctic Exhibit'}
{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Arctic Exhibit'}
>>>
105
106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Lion Dane'}
>>>
105
106
{'Chicken': 14.5, 'Rosted Meat': 10.99, 'Fish': 10.5, 'Pizza': 17.5}
{'Bengal Tiger': 'Jungle House', 'Sloth': 'Rainforest Exhibit', 'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Arctic Exhibit'}
{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Arctic Exhibit'}
{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': 'Lion Dane'}
>>>

"""
Learning Python
Lesson 6 : List & Dictionaries

Simple programming exercises from Codecademy
"""


# Exercise 0 : BeFOR We Begin
"""
    Use a for loop to print out all of the elements in the list names.
"""

names = ["Adam","Alex","Mariah","Martine","Columbus"]
for word in names:
    print word





   
# Exercise 1 : This is KEY!
"""
    Use a for loop to go through the webster dictionary
    and print out all of the definitions.
"""

webster = {
    "Aardvark" : "A star of a popular children's cartoon show.",
    "Baa" : "The sound a goat makes.",
    "Carpet": "Goes on the floor.",
    "Dab": "A small amount."
}
for words in webster:
    print webster[words]








# Exercise 2 : Control Flow and Looping
"""
    Loop through list a and only print out the even numbers.
"""
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
for numbers in a:

    if numbers % 2 == 0:
        print numbers
       


Answers below

>>>
Adam
Alex
Mariah
Martine
Columbus
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
1
2
3
4
5
6
7
8
9
10
11
12
13
>>>
Adam
Alex
Mariah
Martine
Columbus
A star of a popular children's cartoon show.
Goes on the floor.
A small amount.
The sound a goat makes.
0
2
4
6
8
10
12
>>>

Tuesday, June 4, 2013

List lesson

During my fist day in my Intermediate Python program class, I learned about List, the various kinds of list.


 """
Learning Python
Lesson 6 : Lists & Dictionaries
List Functions

Simple programming exercises from Codecademy
"""


# Exercise 0 : Appending & List Length
"""
    Append 3 more items to the suitcase list.
    Then, set list_length equal to the length of suitcase.
"""

suitcase = []
suitcase.append("sunglasses")

# Append 3 more items to the suitcase
suitcase.append("hat")
suitcase.append("shorts")
suitcase.append("shoes")
suitcase.append("beachwear")

# Create a variable called list_length and assign it to the length of suitcase
list_length = len(suitcase)
print "There are %d items in the suitcase." % list_length
print suitcase




# Exercise 1 : List Slicing
"""
    Use list slicing to slice suitcase into 3 parts.
"""

suitcase = ["sunglasses", "hat", "passport", "laptop", "suit", "shoes"]

# Create a variable called first and give it the first 2 items in the suitcase
first = suitcase[0:2]

# Create a variable called middle and give it the next 2 items in the suitcase
middle = suitcase[2:4]

# Create a variable called last and give it the last 2 items in the suitcase
last = suitcase[4:]

# Print your variables: first, middle and last to check your code
print first
print middle
print last





# Exercise 2 : Slicing Lists and Strings
"""
    Assign each variable a slice of animals that
    spells out that variable's name.
"""
animals = "catdogfrog"

# Create a variable called cat and slice the list to get the first three characters
cat= animals[0:3]


# Create a variable called dog and slice the list to get the next three characters
dog= animals[3:6]


# Create a variable called frog and slice the list to get the last four characters
frog= animals[6:]


# Print your variables: cat, dog and frog to check your code
print cat
print dog
print frog



# Exercise 3 : Maintaining Order
"""
    Create a variable called duck_index.
    Use the index() function to assign duck_index to the index of "duck".
    Then insert the string "cobra" at that index.  
"""

animals = ["aardvark", "badger", "duck", "emu", "fox"]


# Assign duck_index to the index of "duck". Use the index() function
duck_index= animals.index("duck")


# Now insert "cobra" into the list of animals at the duck_index
animals.insert(duck_index, "cobra")


# Print the list of animals and see what happens
print animals




# Exercise 4 : For One and All
"""
    Write a statement in the indented part of the for loop
    that prints a number equal to 2 * number for every list item.
"""

my_list = [1,9,3,8,5,7]

for number in my_list:
    # Your code here
    print number * 2




# Exercise 5 : For One and All
"""
    Write a for loop that appends values to square_list
    with items that are the square (x ** 2) of
    each item in start_list. Then sort square_list!
"""

start_list = [5, 3, 1, 2, 4]
square_list = []

# Write a for loop that goes through each number in the start_list
# Append the square of each number to square_list
for number in start_list:
    square_list.append(number ** 2)
    print "Adding the square of %d" % number
    print square_list

# Sort square_list
square_list.sort()


# Print square_list
print square_list





"""
# ************************************************************
# TESTS : DO NOT MODIFY THESE
# ************************************************************
print("")
if list_length == 4 : print("Exercise 0 : Test Passed!")
if first == suitcase[0:2] and middle == suitcase[2:4] and last == suitcase[4:6]: print("Exercise 1 : Test Passed!")
if cat == "cat" and dog == "dog" and frog == "frog" : print("Exercise 2 : Test Passed!")
if animals[duck_index] == "cobra" : print("Exercise 3 : Test Passed!")
if square_list == [1, 4, 9, 16, 25]: print("Exercise 5 : Test Passed!")
"""

Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>>
Traceback (most recent call last):
  File "/tmp/guest-A6n3zJ/Downloads/Lesson6-ListFunctions.py", line 27, in <module>
    print "There are %d items in the suitcase." % list_length
NameError: name 'list_length' is not defined
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
cat
dog
frog
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
cat
dog
frog
['aardvark', 'badger', 'cobra', 'duck', 'emu', 'fox']
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
cat
dog
frog
['aardvark', 'badger', 'cobra', 'duck', 'emu', 'fox']
2
18
6
16
10
14
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
cat
dog
frog
['aardvark', 'badger', 'cobra', 'duck', 'emu', 'fox']
2
18
6
16
10
14
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
cat
dog
frog
['aardvark', 'badger', 'cobra', 'duck', 'emu', 'fox']
2
18
6
16
10
14
[1, 4, 9, 16, 25]
>>>
There are 5 items in the suitcase.
['sunglasses', 'hat', 'shorts', 'shoes', 'beachwear']
['sunglasses', 'hat']
['passport', 'laptop']
['suit', 'shoes']
cat
dog
frog
['aardvark', 'badger', 'cobra', 'duck', 'emu', 'fox']
2
18
6
16
10
14
Adding the square of 5
[25]
Adding the square of 3
[25, 9]
Adding the square of 1
[25, 9, 1]
Adding the square of 2
[25, 9, 1, 4]
Adding the square of 4
[25, 9, 1, 4, 16]
[1, 4, 9, 16, 25]
>>>

Friday, May 31, 2013

LIST LESSON

In Python, a list stores a collection of different pieces of information as a sequence under a single variable name.
For example: grocery_list = [“Milk”, “Eggs”, “Rice”,
There are few code below:
 Learning Python
Lesson 6 : Lists & Dictionaries
List Functions

Simple programming exercises from Codecademy
"""


# Exercise 0 : Appending & List Length
"""
    Append 3 more items to the suitcase list.
    Then, set list_length equal to the length of suitcase.
"""

suitcase = []
suitcase.append("sunglasses")

# Append 3 more items to the suitcase
suitcase.append("hat")
suitcase.append("shorts")
suitcase.append("shoes")

suitcase.append("beachwear")
suitcase.append("T-Shirt")
suitcase.append("laptop")


# Create a variable called list_length and assign it to the length of suitcase
list_length = len(suitcase)


print "There are %d items in the suitcase." % list_length
print suitcase

Answer found below:
Learning Python
Lesson 6 : Lists & Dictionaries
List Functions

Simple programming exercises from Codecademy
"""


# Exercise 0 : Appending & List Length
"""
    Append 3 more items to the suitcase list.
    Then, set list_length equal to the length of suitcase.
"""

suitcase = []
suitcase.append("sunglasses")

# Append 3 more items to the suitcase
suitcase.append("hat")
suitcase.append("shorts")
suitcase.append("shoes")

suitcase.append("beachwear")
suitcase.append("T-Shirt")
suitcase.append("laptop")


# Create a variable called list_length and assign it to the length of suitcase
list_length = len(suitcase)


print "There are %d items in the suitcase." % list_length
print suitcase

Completion of Vacation trip.

I learned on how to plan for a trip through programming.

The vacation trip code below:
"""
Learning Python
Lesson 5 : Functions
Taking a Vacation

Simple programming exercises from Codecademy
"""


# Exercise 0 : Planning Your Trip
"""
    First, write a function called hotel_cost that takes the
    variable nights as input. The function should return how
    much you have to pay if the hotel costs 140 dollars for
    every night that you stay.
"""
def hotel_cost(nights):
    return nights * 140

# Exercise 1 : Getting There
"""
    Write a function called plane_ride_cost that takes a
    string, city, as input. The function should return a
    different price depending on the location. Below are
    the valid destinations and their corresponding round-trip prices.

    "Paris": 183
    "New York": 220
    "Tokyo": 222
    "Istanbul": 475
"""
def plane_ride_cost(city):
    if city == "Paris":
        return 183
    elif city == "New York":
        return 220
    elif city == "Tokyo":
        return 222
    else:
        return 475
   
           
# Exercise 2 : Transportation
"""
    Write a function called rental_car_cost that takes days
    as input and returns the cost for renting a car for said
    number of days. The cost must abide by the following conditions:

    Every day you rent the car is $40.

    If you rent the car for 3 or more days, you get $20 off your total.

    If you rent the car for 7 or more days, you get $50 off your total.
    (This does not stack with the 20 dollars you get
    for renting the car over 3 days.)

"""
def rental_car_cost(days):
    raw_cost = days * 40

    if days >= 3 and days < 7 :
        return raw_cost - 20
    elif days >= 7:
        return raw_cost - 50
    else:
        return raw_cost
       
   
# Exercise 3 : Pull it Together
"""
    Now write a function called trip_cost that takes two inputs,
    city and days. city should be the city that you are going to
    visit and days should be the number of days that you are staying.

    Have your function return the sum of the rental_car_cost,
    hotel_cost, and plane_ride_cost functions with their respective inputs.
"""
def trip_cost(city, days, spending_money):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
       





# Exercise 4 : Expect the Unexpected
"""
    Make it so that your trip_cost function takes a third parameter,
    spending_money. Just modify the trip_cost function to do just as
    it did before, except add the spending money to the total that it
    returns.
"""



# Exercise 5 : Let's go!
"""
    Now that you have it all together, print out the cost of a trip
    to "New York" for 5 days with an extra 200 dollars of spending money.
"""
print trip_cost("New York", 5, 200)

print trip_cost("Istanbul", 10, 100)

print trip_cost("Tokyo", 2, 400)

print trip_cost("Paris", 2, 400)

The answer found below:
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2

1300

Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 4 : Test Passed!
>>>
1300
2325

Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 4 : Test Passed!
>>>
1300
2325
3122

Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 4 : Test Passed!
>>>
1300
2325
3122
943

Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 4 : Test Passed!
>>>
1300
2325
982
943

Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 4 : Test Passed!

Wednesday, May 29, 2013

My Python Class today, May 29ht, 2013 was really good.

Then print type2

    Create a variable called type3 and set it to the type of an string
    Then print type3
"""

# Here's an example for you:
type0 = type(True)
print type0

type1 = type(30)
print type1

type2 = type(6.8)
print type2

type3 = type ("Enjoying my python class !")
print type3

Learning Python
Lesson 5 : Functions
Importing Modules

Simple programming exercises from Codecademy
"""


# Exercise 0 : Generic Imports
"""
    Type import math
    Print the square root of 25
    For example, print math.sqrt(36) will print 6.0
"""

from math import*
print sqrt(144)

# Exercise 1 : Function Imports
"""
    Change the import so that you only import the sqrt function, like this:
    from math import sqrt
    Print the square root of 100
    For example, print sqrt(81) will print 9.0
"""





# Exercise 2 : Function Imports
"""
    Change the import so that you import everything from the math module, like this:
    from math import *
    Print the square root of 144
    For example, print sqrt(25) will print 5.0
"""



These are few answers from this class.
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>>
10
>>>
10
7
>>>
10
They are equal
>>>
10
87
>>>
10
-10
10
<type 'bool'>

Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Failed!
Exercise 2 : Test Failed!
Exercise 3 : Test Failed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
<type 'bool'>

Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Failed!
Exercise 3 : Test Failed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
<type 'bool'>

Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Failed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
42
<type 'bool'>

Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Passed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
42
<type 'bool'>
<type 'int'>

Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Passed!
Exercise 4 : Test Failed!
>>>
10
-10
10
9
-5
42
<type 'bool'>
<type 'int'>
<type 'float'>
<type 'str'>

Here are the results of Lesson 5: Functions
Exercise 0 : Test Passed!
Exercise 1 : Test Passed!
Exercise 2 : Test Passed!
Exercise 3 : Test Passed!
Exercise 4 : Test Passed!
>>>
6.0

>>>
5.0


10.0

>>>
10.0

>>>
12.0