MrSchmid.com

Python

Functions in Python

Posted On: Mon, 2008-04-28 14:49 by mrschmid

Functions

 So far we’ve been using built in functions such as int() and raw_input(), but now it’s time for us to create our own functions. By creating functions we will save us time and money (well not actually any money, but saving time is nice). We can create small working functions and use them multiple times throughout our program. We can also reuse functions between programs.

 

Defining Functions

We define a function by using the following line-

Def functionname():

Anything indented under the def command will be part of the function.

The next line is documentation. Text in triple quotes will explain what the function does.

Complete the instructions program

 

Click Read More for the rest...

( categories: | )

For Loops, Slicing and Tuples

Posted On: Mon, 2008-04-21 14:47 by mrschmid

Invinite Loop For Loops:

While loops continue until a condition is met. For loops continue through a sequence. For each item or step the for loop will continue. For loops can replace those while counting loops that we had used before.

Loopy String

Counter Program

This counter program uses the for loop with the range() function. The range function returns a range of numbers from the starting value to the ending value. A step number can be used that will count by that number (fives for example). Range(starting value, ending value, step by value)

Click Read More for the rest...

 

( categories: | )

Branching, while Loops, and If - then

Posted On: Wed, 2008-03-26 14:52 by mrschmid

Branching, while Loops, and If - then

 Indentation:

Python is unique in that it requires blocks of code under a branching operator to be indented. Any line of code that is indented under an IF statement is code that will be executed if that IF statement is true. It doesn’t matter how you indent, but you must be consistent with your indentation. You can use 1 tab, or 2 spaces, or 4 spaces, but using 2 when you have been using 3 spaces will create problems.

( categories: | )

WQoftW #3 - How Routers Work

Posted On: Mon, 2008-03-24 12:26 by mrschmid

How Routers Work – Quiz
How Routers Work Article
Routers Quiz
Remember, be sure you are happy with the quiz before you submit. The first quiz results sent to me will count as the grade for the quiz.

( categories: | )

Types and Variables, Input and Output

Posted On: Wed, 2008-03-19 14:07 by mrschmid

carpet python Types and Variables, Input and Output

  • Strings – Remember, Strings are nuggets of text that can be displayed or manipulated
  • Triple Quotes – “”” triple quotes allow use to continue a string that extends for more than one line.
  • Quotes inside strings - to use a quote inside of a string with out ending the string we use an escape string that differentiates the quote from the ending quotes for the string. - \’ or \”
  • the \ to continue on new line allows us to continue one command onto the next line. Makes the code easier to read for humans, but makes no difference for the computer
  • Ascii Art - http://www.network-science.de/ascii/

    Hello World 2.0

  • Click Read More to see the rest.
( categories: | )

What is Python

Posted On: Tue, 2008-03-18 15:13 by mrschmid

python tshirt What is Python?

Python is a programming language created by Guido van Rossum and released in 1991. Python is great for small projects as well as larger, more critical uses.

History

Guido van Rossum started the process of creating a new programming language to replace the ABC language in the 1980’s. Python reached python 1.0 status in 1994. Guido started the Computer Programming for Everybody project that aimed for all computer users to have a basic understanding of programming through the use of python. Python has always been under a open license, but due to some legal issues wasn’t considered GNU GPL compliant until 2001. Much of the success of Python as a language is due to the community of developers and the open source model.

( categories: | )

WTQoftW #2 - CGI Scripting

Posted On: Mon, 2008-03-17 15:27 by mrschmid

How CGI Scripting Works – Quiz
How CGI Scripting Works Article
CGI Scripting Quiz
Remember, be sure you are happy with the quiz before you submit. The first quiz results sent to me will count as the grade for the quiz.

( categories: | )

How Programming Works and Programming Languages

Posted On: Fri, 2008-03-14 12:58 by mrschmid
how programming works title


How a program works-

A computer will not do anything without being told to. Just like you. Programming is simply giving the computer extremely specific instructions in order to accomplish your task. There are only two ways to get the instructions (a program) to accomplish a specific task. 1) write the program yourself (or modify someone else’s) or 2) buy or acquire a program that someone else has made to accomplish the same task. A program works by taking input, manipulating it, and spitting it back out (output). Here are some common programs and the input and output they deal with.
Click Read More to see the rest of the article

( categories: | )

Beginning Programming

Posted On: Thu, 2008-03-13 15:03 by mrschmid

code monkey
(it's a code monkey !)
Anyone can program, it doesn’t take a high IQ, or a passion for math. It’s a skill just like riding a bicycle or juggling. It only requires a desire to learn (which we all have) and the patience and persistence to work hard. Time and practice is all that’s keeping anyone from becoming a master programmer, that’s why we hear of young kids writing programs. They’re not geniuses, they just have the time and aren’t afraid to fail along the way.

After we complete our section on programming, you will be able to choose the best language to use for your project, you will understand and have experience using the tools that programmers use, and you will be able to create programs for personal or commercial use.

Like most areas we cover in class, we will only barely scratch the surface on the subject of programming. I encourage you to do your own research into areas that interest you. You will never learn everything you need to know from a class or a book. Using technology is an on-going learning experience where you must be active in searching out answers for your questions. You must be the motivating factor to find the answers, as in life most answers are not spelled out to you in the sky in gold letters.
Click Read More to see the rest of the article

( categories: | )

WTQoftW #1

Posted On: Thu, 2008-03-13 15:02 by mrschmid

How Web Servers Work – Quiz
How Web Servers Work Article
Web Servers Quiz
Remember, be sure you are happy with the quiz before you submit. The first quiz results sent to me will count as the grade for the quiz.

( categories: | )
Syndicate content

Poll