News:

 

Press Spacebar to continue

Hardware Basics



Marshall Brain – Computer tour, http://videos.howstuffworks.com/howstuffworks/23-computer-tour-video.htm

5 Minutes with Python - A Video Series

Press Spacebar to continue

Software Development Steps

  1. Analyze the problem. Know what is being considered.

  2. Determine specifications. Know what are the inputs and outputs.

Press Spacebar to continue

  1. Create a design.
    1. ask for first input, store in dollars
    2. ask for second input, store in exchangeRate
    3. compute euros = dollars*exchangeRate
    4. output   dollars "= " euros

Press Spacebar to continue

  1. Implement. Write in Python
    def main():
      	dollars = input("Enter the amount of dollars: ")
    	exchangeRate = input("Enter the current exchange rate: )
    	euros = dollars * exchangeRate
    	print dollars, "Dollars = ", euros, "Euros"
    	
    main()
  2. Test/Debug the software
  3. Maintain the software. Talk with customers see what problems they may have, and what improvements they suggest.

 

Press Spacebar to continue

Review the Chaos program

Statements that begin with # are comments - read and understood only by humans

# File: Chaos.py
# A simple program illustrating chaotic behavior

A Python program has a function named main () in it. 
That is where execution begins

def main(): After a : statements are indented. Python uses a block structure
A print statement causes the string enclosed in "s to be sent to
the output device

print "This program illustrates chaotic function"
An input statement sends the string in ( and "s ) to the output device Waits for the user to enter something with the input device and stores the value in the variable whose name is on the left. x = input("Enter a number between 0 and 1: ") We can assign a variable a value using =
y = 0
The for statements sets up a repetition or loop. The statements that are repeated are in a block. Note the use of : and indentation again. This one is a loop that is executed 10 times. The values of i are 0,1,2,...,9 Here they are only used for counting for i in range(10):
In this and every assignment statement, the expression on right is evaluated and the value is stored in the variable whose name is on the left x = 3.9*x*(1-x)
Here the values stored in x and y are sent to the output device. First x and then y print x, x - y
Now the value stored in x is copied to the location whose name is y y = x

The above is definition of main(), and the next statement actually
informs the language system to start executing the instructions therein.

main()

Press Spacebar to continue

Try a problem of our own

Write a program that converts kilometers to miles.

  1. With a partner, analyze problem.
  2. Determine input, output, and process.
  3. Develop a design

When these last two steps are approved by me (bring your design to the front of the room.)

Then develop code, and go to lab to enter the code

Test the program.

Send me a copy of the completed program

 

Kevin Kelly: Predicting the next 5,000 days of the web, http://www.ted.com/index.php/talks/kevin_kelly_on_the_next_5_000_days_of_the_web.html

Press Spacebar to continue


Creative Commons License
This work is licensed under a Creative Commons License.
Ernest Ackermann Department of Computer Science, Mary Washington College
CPSC 110 | CPSC 330 | CPSC 401

Bibliographic Information: