ZZucker 342 Practically a Master Poster

Do first what you dread the most.

ZZucker 342 Practically a Master Poster

The most expensive block of cheese ever sold weighed just about 10 pounds, and sold for a total of $21,400.

ZZucker 342 Practically a Master Poster

LOVL. Unquestionably incredible indeed!

ZZucker 342 Practically a Master Poster

... next time don't take pictures from Wikipedia :)

Does that mean you can only post pictures you took yourself? I didn't know that!

ZZucker 342 Practically a Master Poster

On the lighter side:

If all the girls who attended the Yale prom were laid end to end, I wouldn't be a bit surprised.
A quote by Dorothy Parker

A side note: In her early life writer and poet Dorothy Parker attended Roman Catholic elementary school but was asked to leave following her characterization of the Immaculate Conception as "spontaneous combustion."

ZZucker 342 Practically a Master Poster

A very nice and funny web page! Thanks Dude.

ZZucker 342 Practically a Master Poster

Does that mean that whoever has the most boring clergy gets elected?

ZZucker 342 Practically a Master Poster

The English language is tough:

ZZucker 342 Practically a Master Poster

Just one bacteria can multiply to one billion in less than 24 hours.

ZZucker 342 Practically a Master Poster

Assassination is the extreme form of censorship.
Quoted by George Bernard Shaw

ZZucker 342 Practically a Master Poster

Bunch of ginger cookies. Moca latte with a touch of nutmeg.

ZZucker 342 Practically a Master Poster

Yeah Dude, lovely site!

ZZucker 342 Practically a Master Poster

Plane #36 could be one of those Phantom jet fighters?

ZZucker 342 Practically a Master Poster

Somebody in our neighborhood is driving a Bentley Azure, that would be my dream car! However the $348000 price tag is just mildly more than what I have in pocket change.

ZZucker 342 Practically a Master Poster

Vega left a small code snippet about plotting with Tkinter, check:
http://www.daniweb.com/code/snippet578.html

ZZucker 342 Practically a Master Poster

Hmm, I needed something like that myself, so I fiddled with it:

# find the substring between two given marker strings

s = "ab blah cde notblah fghij blah klm notblah no blah stu notblah xyz"

# marker strings
s1 = "blah"
s2 = "notblah"

word_list = s.split()
start = 0
for word in word_list:
    if word == s1:
        # index of marker strings
        start = word_list.index(s1, start)
        end = word_list.index(s2, start)
        # move it up by 1
        start += 1
        # slice list
        sub_list = word_list[start: end]
        # join to form string
        sub_string = ''.join(sub_list)
        print sub_string
ZZucker 342 Practically a Master Poster

You cannot use the line:

if sex == "M" or "m":

In Python you have to write it this way:

if sex == "M" or sex == "m":

Actually you might just use:

if sex in ["M", "m"]:
gwarguy commented: Thanks for explaining my problem in a clear manner as fit to my little or no experience:) +1
ZZucker 342 Practically a Master Poster

I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world.
-- Albert Einstein

Ah, another nice quote from good old Albert!

To educate a person in mind and not in morals is to educate a menace to society.
-- Theodore Roosevelt

ZZucker 342 Practically a Master Poster

George W. Bush's Crawford, TX ranch has the following vehicles registered to it:
five passenger cars,
seven trucks,
five tractors and
18 gas-powered golf carts.

ZZucker 342 Practically a Master Poster

I have 270 post right now! Actually 271 after I post this.

ZZucker 342 Practically a Master Poster

Made an egg salad from the Easter eggs friends gave me, yum yum!

ZZucker 342 Practically a Master Poster

Ancient Dragon:
AD's opinions are exactly the same as my grandpa Simon's. So I imagine him to be a friendly little old wise man with a billiard ball head.

ZZucker 342 Practically a Master Poster

Very funny find there Dude.

ZZucker 342 Practically a Master Poster

A picture is worth 87 words:

ZZucker 342 Practically a Master Poster

In the US, only 14 percent of the clear tape commonly called "Scotch tape" is actually Scotch brand tape.

ZZucker 342 Practically a Master Poster

Give a man a fire and he's warm for a day, but set his soul on fire and he's warm for the rest of his life.

thunderstorm98 commented: Nice One... +3
ZZucker 342 Practically a Master Poster

we had a woman president decades upon decades ago - margret thatcher

Is she the one that won the Falkland War?

ZZucker 342 Practically a Master Poster

jbennet:
The real computer genius here. Never gives you an old and stale idea or opinion. His only challenge is the English language, probably because he is Scottish. I don't know what the native language of Scottland is?

ZZucker 342 Practically a Master Poster

God is subtle, but he is not malicious.
-- Albert Einstein

ZZucker 342 Practically a Master Poster

Look at the syntax of Java and Python. Which one would you rather use?

ZZucker 342 Practically a Master Poster

Also avoid using type, since that is a builtin Python function name.

You could keep track of your input in a dictionary:

d = {}

# input value and variable name
d[raw_input('Enter variable name: ')] = raw_input('Your value: ')

print d, d.keys(), d.values()

I am not quite sure where you want to go with this, it doesn't make much sense! If the user enters the variable name, and picks a Python keyword or function name, you get into all sorts of errors!

ZZucker 342 Practically a Master Poster

Here is a small dictionary of food items and their calories. The portion amounts vary all over the map. Convert all calories for a 1 oz portion or, if you desire, a 100 gram portion (1 oz = 28.35 grams):

# a dictionary of {food_name:[amount, calories], ...}
food = {
"pastrami": ["2 oz", 170],
"meatloaf": ["3 oz", 315],
"veal": ["3.5 oz", 190],
"beef": ["2 oz", 310],
"venison": ["4 oz", 225],
"potato": ["8 oz", 100],
"spinach": ["8 oz", 45],
"tomato": ["8 oz", 45],
"egg plant": ["3.5 oz", 25],
"cauliflower": ["8 oz", 35],
"butter": ["1 oz", 200],
"cheddar": ["1 oz", 115],
"swiss": ["1 oz", 105],
"egg": ["2 oz", 80]
}
ZZucker 342 Practically a Master Poster

Dude, you are great at finding those little gems!

ZZucker 342 Practically a Master Poster

Toasted English muffins with gooseberry jam and my usual mug of Santos coffee with a touch of brandy.

ZZucker 342 Practically a Master Poster

Laughed a lot over the pictures and the comments!

ZZucker 342 Practically a Master Poster

There are more rings in America than there are fingers.

ZZucker 342 Practically a Master Poster

If you’re looking for friends when you need them … it’s too late.

ZZucker 342 Practically a Master Poster

People react to fear, not love; they don't teach that in Sunday School, but it's true.
-- Richard M. Nixon

ZZucker 342 Practically a Master Poster

Certainly in the next 50 years we shall see a woman president, perhaps sooner than you think. A woman can and should be able to do any political job that a man can do.
-- Richard M. Nixon

ZZucker 342 Practically a Master Poster

As this long and difficult war ends, I would like to address a few special words to the American people: Your steadfastness in supporting our insistence on peace with honor has made peace with honor possible.
-- Richard M. Nixon

ZZucker 342 Practically a Master Poster

Americans admire a people who can scratch a desert and produce a garden. The Israelis have shown qualities that Americans identify with: guts, patriotism, idealism, a passion for freedom. I have seen it. I know. I believe that.
-- Richard M. Nixon

ZZucker 342 Practically a Master Poster

It looks like the Easter Bunny leaves more than just eggs in the yard.

ZZucker 342 Practically a Master Poster

I have accidently knocked the puck into my own goal :D

I do that a lot! It's a fun game anyway! Good find there Dude.

ZZucker 342 Practically a Master Poster

You can use Tkinter running in the background:

# respond to a key without the need to press enter

import Tkinter as tk

def keypress(event):
    if event.keysym == 'Escape':
        root.destroy()
    x = event.char
    if x == "w":
        print "blaw blaw blaw"
    elif x == "a":
        print "blaha blaha blaha"
    elif x == "s":
        print "blash blash blash"
    elif x == "d":
        print "blad blad blad"
    else:
        print x


root = tk.Tk()
print "Press a key (Escape key to exit):"
root.bind_all('<Key>', keypress)
# don't show the tk window
root.withdraw()
root.mainloop()

You can use getch(), but it has limitations:

# print characters typed, no Enter needed
# works only with Windows since it imports msvcrt.dll
# also works only in the cmd window

from msvcrt import getch

while True:
    z = getch()
    # escape key to exit
    if ord(z) == 27:
        break
    print z
ZZucker 342 Practically a Master Poster

... can I remove the marks like (? "" [] ) .. etc ineed only words

Instead of
word = word.rstrip('.,')
use
word = word.rstrip('.,?"[]()')

... control number of word to be enter by user

Where you now have
if n < 10:
use
if n < select:
where variable select is an integer from the user's input

... can python bult user interfac (buttun ,text box etc) and how ?

Python has a simple GUI toolkit called Tkinter supplied that can do all that for you. You need to study up on that, it's a whole new ball of wax. Here would be a typical example:

# a look at the Tkinter Text widget
# use ctrl+c to copy, ctrl+x to cut selected text, 
# ctrl+v to paste, and ctrl+/ to select all

import Tkinter as tk

def get_text():
    # get text widget contents between start_index and end_index
    # start_index = "%d.%d" % (line, column)  here "1.0"
    # line starts with 1 and column with 0
    # here end_index = tk.END    
    # set the label text to the typed-in text
    v1.set(text1.get(1.0, tk.END))
    # clear the text
    text1.delete(1.0, tk.END)      
    text1.insert(tk.INSERT, ' new text')
    text1.insert(tk.INSERT, '\n and more text')

# this sets the window title caption too
# without the leading space Text will be text!?
root = tk.Tk(className = " Text, Button, Label ...")

# text entry field, width=width chars, height=lines text
text1 = tk.Text(root, width=50, height=2, …
ZZucker 342 Practically a Master Poster

The way the Dollar is sinking it reminds me of the old Italian Lira. We could soon see Trillionairs in the US.

ZZucker 342 Practically a Master Poster

All the King's Horses and All the King's Men
Can't Seem to Put the US Economy Back Together Again

ZZucker 342 Practically a Master Poster

You can use
number = number + 1
or
number += 1

ZZucker 342 Practically a Master Poster

Try
def testing(self, *args):

ZZucker 342 Practically a Master Poster

If you just want to count the words, lines and characters in a text file, Python offers an elegant solution:

# find the number of lines, words and characters in a text file

# these are the counters, start at zero
number_lines = 0
number_words = 0
number_characters = 0

# pick a text file you have
filename = 'my_text.txt'
for line in file(filename):
    # update the counters
    number_lines += 1
    number_words += len(line.split())
    number_characters += len(line)
    
print filename, 'has:'
print number_lines, 'lines'
print number_words, 'words'
print number_characters, 'characters'

Thanks to bgeddy for his inspiring pseudo code.

vegaseat commented: Another example of clean code +8