Lab

Introduction to Python:

In today’s lab Introduction to Python we had to complete the Tip Calculator tutorial. in this tutorial code academy had us assign each variable and value. We assigned Meal to equal 44.50, Tip to equal 15 % which converts to 0.15 and we assigned Tax to equal to 6.75 which converts to 0.0675. This isn’t the first time i coded so i have some experiences which help me understand python

Screen Shot 2015-09-04 at 3.48.09 PM Screen Shot 2015-09-04 at 3.48.13 PM Screen Shot 2015-09-04 at 3.48.16 PM Screen Shot 2015-09-04 at 3.48.19 PM Screen Shot 2015-09-04 at 3.48.22 PM

Taking a Vacation:

In today’s lab Function we had to complete the Taking a Vacation tutorial. In this tutorial we had to use functions such as  if, else and if and else together (elif). We had to calculate the cost to Charlotte, Tampa, Pittsburgh and Los Angeles, also transportation with the deals they offer depending how long we stay and spending money. This lab was short but difficult because of the functions and defining each variable also indenting wrong can give you a syntax error.1 2 3 4 5 6 7

 

Turtle Blast:

Today in class we had to make a image using the Turtle and random modules from python, these are the following steps. Change the color of the window to “red” using he .bgcolor property of the screen variable you create. Your turtle variable has to have a pen color “white”, you have to use the .pencolor property of your turtle variable. You have to make your turtle to change its heading to the right with an random angle between 0 and 45 degrees. Move your turtle forward a random distance between 0 and 150 pixels. Then move the turtle backward the same distance than above Repeat the last three steps 100 times. Instead of repeating the last step a 100 times we can use the ‘for x in range’ function.


import turtle
import random
wn= turtle.Screen()
wn.bgcolor("red")
andrew=turtle.Turtle()
andrew.pencolor("white")
andrew.speed(0)
for x in range(100):
 angle = random.randint(0,45)
 andrew.right(angle)
 distance1 = random.randint(0,150)
 andrew.forward(distance1)
 andrew.back(distance1)

TB

Date and Time:

In today’s we had to use strings to import the time. we used now = datetime.now() to state the current time, ‘%s/%s/%s was used to follow the format  / / , %s:%s:%s was used to follow the format : : .

dt6 dt5 dt4 dt3 dt2 dt1




Battle Ship:


Today in class we had to create a real battle ship game in code academy. it was very hard to complete this because there was a lot of ups and downs. During the completion of this lab i had to watch out on my indents or you will get an error, i also encountered with error on my capitalization on certain words.  






battle

A Day at the Supermakrt

Today in class we had to do list and Dictionaries in code academy.  We had to code a regualr day in the supermarekt, using list loops   and dictionaries.
Screen Shot 2015-12-02 at 6.35.53 PM
Advanced Topics in Python
In this exercise of python, we had to use iteration over data structures, list comprehensions, list slicing and lambda expressions.
pg. 15

pg. 16

pg. 17

pg.18