CIT 590 Homework 3 Three Musketeers
Purposes of this assignment
To give you experience with using lists and tuples
To get you started writing unit tests
General idea of the assignment
Write a program to play the game of Three Musketeers-human against comp
CIT 590 Homework 2 - Pig
Purpose of this assignment:
Get acquainted with Python functions
"Pig" is a very simple game. Two players take turns; on each turn, a player rolls a six-sided die
("die" is the singular of "dice") as many times as she wishes, or u
Option Explicit
Dim demanda(1 To 5), coston(1 To 5), costoex(1 To 5)
Sub Preliminary_Definitions()
Call fillarray(demanda, "cfw_900,800,1000,1200", 1)
Call fillarray(coston, "cfw_3,4,2,5", 1)
Call fillarray(costoex, "cfw_3.5,5,2.5,7", 1)
End Sub
Sub Model
Tecnologa de los procesos de Manufactura IN179
Cronograma actividades para 2017-1
TEORIA
Semana
Unidad
1
1y2
2
Temas
LABORATORIO
Fecha
Presentacin
PC TF
Actividades
Introduccin. Fundicin
Introduccin
2
Fundicin
Mediciones. Herramientas de banco
3
2
Fundici
Curso de Seguridad y Salud Ocupacional
Trabajo de investigacin.
Disear y/o recomendar un sistema de gestin de seguridad y
salud en el trabajo, mediante el diagnstico inicial y basndose
en la mejora continua
1.- Descripcin general de la empresa
1.1 Razn so
Unit Testing
Publicity
Would you like to get your name, or the name of your project, in the newspapers?
Here are some of the more well-known stories about computer programs:
Mariner 1 to Venus-Incorrect data smoothing caused the spacecraft to be
destroyed
Variables and Values
Names
Variables (which hold values) and functions (which are
blocks of code) both have names
Names must begin with a letter and may contain
letters, digits, and underscores
Names are case-sensitivetotal, TOTAL, and
Total are three dif
Functions
Execution order
When you load and run a Python module (file), the statements and definitions in the file
are executed in the order in which they occur
Executing a def defines a function, it doesnt run the function
Functions are only run when the
Errors
And How to Handle Them
GIGO
There is a saying in computer science: Garbage in, garbage out.
Is this true, or is it just an excuse for bad programming?
Answer: Both.
Heres what you want:
Can you do it?
Errors and exceptions
Your program isnt alone i
Just Enough Python
Python 3 and IDLE
We will use version 3.x of Python (where x is the most recent
version
Differences between Python 2 and Python 3 are mostly minor, but
can be confusing
Python comes with an IDE (Integrated Development
Environment) calle
Data Structures
Lists, Tuples, Sets, Dictionaries
Collections
Programs work with simple values: integers, floats, booleans, strings
Often, however, we need to work with collections of values (customers,
books, inventory items, etc.)
Python supplies four k
More About Values
Casts
To cast is to take a value of one type and return the corresponding value of
some other type (or an error, if the cast is impossible)
int(x) casts a string, float, or boolean x to an integer
float(x) casts a string, integer, or boo
Using IDLE
Basic use of IDLE
Start IDLE
You can type simple expressions and code directly into the shell window
that comes up
You can use the up-arrow to go back and repeat previous lines
This is convenient for trying things out, or to use as a calculator
Math
The math module
import math will let you use quite a lot of built-in mathematical
functions
math.pi and math.e are the values and e, respectively
math.log(x, base), math.log2(x), and
math.log10(x) return logarithms of x
math.pow(x, y) returns x raise
More About Loops
while loops
The while loop is the simplest kind of
loop
The test is performed before the
statements are executed
Thus, if the test is initially False,
the while loop does nothing
If the test is True, the statements are
executed, then the
Spring, 2016
CIT 590
Programming Languages and Techniques
Homework 10
All deadlines as per canvas
This homework deals with the following topics
* Designing a user interface.
* Working with some starter code (not doing everything from scratch).
* Making so
Spring, 2016
CIT 590
Programming Languages and Techniques
Homework 4
This homework deals with the following topics
* dictionaries, sets and lists
* databases using dictionaries (not too far from how they really work!)
* test driven development (TDD)
Gener
Recitation 4
Recitation Questions.
The first few questions are from last week. Let us know which ones you want us to
discuss.
1. a) There are 32 first year MCITs and as part of 591 recitation they are told to randomly pair up and do pair programming. How
Recitation 3
Recitation Questions.
1. a) How many base 10 numbers have 5 digits.
b) How many 5 digit numbers have no two consecutive digits equal.
c) How many have at least 1 pair of consecutive digits equal.
SOLUTION:
a) 9 10 10 10 10 = 9 104
b) 9 9 9 9
Recitation 3
Recitation Questions.
1. a) How many base 10 numbers have 5 digits.
b) How many 5 digit numbers have no two consecutive digits equal.
c) How many have at least 1 pair of consecutive digits equal.
2. A palindrome is a word that reads the same
Recitation
Recitation Questions.
1. What is R Q? What is Q Z?
2. What is P (P ()?
3. For the sets A, B, C as defined below
A = cfw_1, 2, 5, 8 B = cfw_3, 4, 1, 2, 7 C = cfw_3, 2
what is
A B, A B, A C, C A, A B
4. List the elements of this set explicitly
cf
ADT
algorithm
ArrayList (java)
arrays (as a data structure)
arrays (as an ADT)
big oh notation
blackbox testing
boundary value analysis
chaining (hash)
circular linked list
class diagram
collision (hash)
collision resolution strategies
compression functio
ADT
adapter
adjacency list
adjacency matrix
algorithm
anti-pattern
ArrayList (java)
arrays (as a data structure)
arrays (as an ADT)
big ball of mud
big oh notation
binary expression tree
binary search tree
binary tree
black height (red-black tree)
blackbo
Growth of functions
10/8/09 3:49 PM
Growth of functions
We assume that 1 operation takes 10-6 seconds.
All times are approximate. Missing entries are too large to include. For
comparison, the number of atoms in the universe has been estimated at
somewhere
Welcome!
CIT 595
Computer Systems
Programming
Spring 2016
Instructor: Chris Murphy
UPenn CIS faculty member since 2010
Director of MCIT since 2014
PhD-Computer Science, Columbia University
Seven years experience in software industry
BS-Computer Engineerin
Announcements
Homework #1 will be posted soon
Due next Friday Jan 29 5:00pm
Please read and understand the section on
Academic Honesty
This weeks office hours will be posted in Piazza
Last Time
Course overview
The stack revisited
Pointers
Schedule
Today: