LAB 1: TIP CALCULATOR



LAB 2: PLANNING A VACATION







LAB # 3 TURTLE GRAPHICS
Today we were introduced how to draw pictures using Turtle Graphics. We learned some basic turtle control functions and how to import them into our Python programs.We created a program that moves an arrow different directions but all based on the commands and angles given it. The turtle is imaginative in much ways imagine holding a pencil over a blank paper and having someone telling you what to draw. Its the same concept except the directions are in code imported from the turtle module.
Here is the code for the turtle blast:
Results of the code once i ran it:
LAB # 5: Fruitful functions Fermat’s Last Theorem
The objective of this lab was to test a famous mathematicians formula in python. The formula is named Fermat’s Last Theorem . It states that no three positive integers a, b, and c can satisfy the equation an + bn = cn for any integer value of n greater than two. The cases n = 1 and n = 2 were known to have infinitely many solutions. If
The objective was to give the user of the interface an option to choose the values of A, B,C, and N. The program would than return a statement based on the users input. If N is chosen to be any number other than 1 the user will get a return of “No, that doesn’t work” if 1 is chosen it will display “Fermat was Wrong”.
Here is the code and once ran will execute with no errors in python 3.4.
LAB # 6: DATE and TIME
Date and time is an exercise in code academy. The point of the project is to be able to tell python to return values of the date and time of the day or any specific value in specific formats. for example, python can be directed to return the date in the form of mm/dd/yy or in form of dd/mm/yy which ever is desired. The equivalent can also be done with the time in hr/min/sec or vice versa. The str() and %s were used also merging them together.
LAB # 7: BATTLESHIP
Description:
Battleship is a classic digital game. The purpose/goal is a one-player version of the classic board game Battleship! In this version of the game, there will be a single ship hidden in a random location on a 5×5 grid. The player will have 10 guesses to try to sink the ship. To build this game we will use our knowledge of lists, conditionals and functions in Python. When you’re ready to get started, click run to continue.
These are the pictures of the final code of the entire game completed.
LAB # 8: A DAY IN THE SUPERMARKET
The purpose of this lab is to integrate all that we’ve learned thus far into a program for going to the supermarket. This code will consist of for, while, if elif and more functions as such. It also enforces strings and the slicing and addition. Further more its teaches about using the function dict to define words in a list, add new words to that list, remove words without editing the original list. from the. append, .remove and such we can add and edit the original list.
here are the images of the 13 steps into making the full code.
LAB # 9: REVIEW OF ADVANCED TOPICS IN PYTHON:
This week we focused on a new method of creating lists many called lambda, a built in python function which makes it easier to create lists without a return value. lambdas are useful when you need a quick function to do some work for you.If you plan on creating a function you’ll use over and over, you’re better off using def
and giving that function a name. In addition we also learned further on list slicing, omitting indices lists and reverse a list with the (-) function.
***HERE ARE THE IMAGES OF THE REVIEW SUMMARY
LAB # 10: PYGLATN
In this lab we took over what we learned from the previous exercise in CONDITIONALS & CONTROL FLOW which includes string manipulation and branching and applied it to making Pig Latin translator for programmers.
FOLLOWING ARE THE SCRENSHOOTS OF THE CODE FROM 1-11.