sneekula 969 Nearly a Posting Maven

Firstly, raw_input gives you a string, so you don't need str(), and you also can remove:
" \n\nPlease dont try medium or hard as they are still in progress"
since it is implemented.

Secondly remove the else above
"# Substraction Calculations"
and bring the whole block's indentation level even with Addition Calculations.

There are a whole number of other improvements possible:

operation = raw_input("\t\t\tAddition (A) or Substraction (S): ").capitalize()
difficulty = raw_input("\tSelect a difficulty - Easy (E)(1-100), Medium (M)(1-200) or Hard (H)(1-500): ").capitalize()
if "A" in operation:
    print
    print "Addition"
    print '** ** **'
    print
if "S" in operation:
    print
    print "Subtraction"
    print '** ** ** **'
    print

# that allows you to later use, similar for "M" and "H"
    if "E" in difficulty:
# rather than the awkward
    if difficulty == "Easy" or difficulty == "easy" or difficulty == "E" or difficulty == "e":

There are plenty more problem spots however.
Just work on it, you learn from it, and ultimately the code will look a lot simpler!

sneekula 969 Nearly a Posting Maven

Spelling a string in reverse the old fashioned way is always a good exercise in any computer language.

Here is an example in C language:

// spell a text string forward and backward

#include <stdio.h>

int main(void)
{
  char text[80];
  int k;

  strcpy(text, "Spell this string forward then backward");
  printf("String = %s \n", text);

  // forward spelling puts a space between characters
  for(k = 0; k < strlen(text); k++)
    printf("%c ", text[k]);
  printf("\n\n");

  // now the reverse spelling
  for(k = strlen(text)-1; k >= 0; k--)
    printf("%c ", text[k]);
    
  getchar();  // wait
}

This would be its Python language counter part:

text = "Spell this string forward then backward"
print text

# as you spell forward the comma puts a space between characters
for c in text:
    print c,

print "\n"

# now the reverse spelling
for c in reversed(text):
    print c,

raw_input()  # wait
sneekula 969 Nearly a Posting Maven

Man, you should visit London for excursion on church conversions...
I know at least 10 in my closes area

I know people have turned some of the smaller churches into interesting homes for themselves.

sneekula 969 Nearly a Posting Maven

When you sneeze, all bodily functions stop-- even your heart!

Amazing! I wonder if SCUBA divers can sneeze under water?

sneekula 969 Nearly a Posting Maven

Did you see Venus and Serena Williams snap up the gold? That makes it two Olympic games in the row. Black chicks are hot!

I think they would have won more gold if they had forehand, backhand, two handed, one legged, backwards, blindfolded, 50 meter, 100 meter, 200 meter, 500 meter, half hour, one hour, two hour and wall tennis events in the Olympics.

sneekula 969 Nearly a Posting Maven

A pair of sunnyside up jumbo eggs.
Yes, I have egg on my face! I am a messy eater.

sneekula 969 Nearly a Posting Maven

Henry Ford produced the model T only in black because the black paint available at the time was the fastest to dry.

I believe that he told his customers "You can have a car in any color you want as long as it is black"

Must be true, I have seen t-shirts with that famous Henry Ford quote on it.

Talking about cars:
Almost a quarter of the land area of Los Angeles is taken up by automobiles.

sneekula 969 Nearly a Posting Maven

One more funny bumper sticker:

sneekula 969 Nearly a Posting Maven

McCain needs your vote!

Oh yes, four more years of irresponsible fiscal behaviour, just what this country needs. God help us all!

sneekula 969 Nearly a Posting Maven

Regarded as the first virus to hit personal computers worldwide, "Elk Cloner" spread through Apple II floppy disks. The programme was authored by Rich Skrenta, a ninth-grade student then, who wanted to play a joke on his schoolmates.

Now that is real great information!

This is almost as good: :)
SCUBA divers cannot pass gas at depths of 33 feet or below.

sneekula 969 Nearly a Posting Maven

Uncle John's readers are a REALLY poor source for information, they mostly repeat Urban Legends as fact.

I think it is much more reliable than the Internet. After all, Uncle John had to put his name to it! :)

Henry Ford produced the model T only in black because the black paint available at the time was the fastest to dry.

sneekula 969 Nearly a Posting Maven

Add the line
number1 = number2 = number3 = number4 = number5 = number6 = 0
right below the line
counter = counter +1

This way your line 64 does not mix up the possible answers and Python knows about all the variables used in that line.

leegeorg07 commented: v helpful +1
sneekula 969 Nearly a Posting Maven

Interesting problems, but you got to show us some code of your own attempts at this!

sneekula 969 Nearly a Posting Maven

How did a fool and his money get together in the first place, so he could later quickly part with it?

sneekula 969 Nearly a Posting Maven

Did the Republican and Democrat Conventions already happen, or are they waiting for the Olympics to end?

sneekula 969 Nearly a Posting Maven

The next time you step on a scale consider this:

The mass of Earth is 6370000000000000000000000 Kg.

The mass of the Sun 198000000000000000000000000000000 Kg.

sneekula 969 Nearly a Posting Maven

The earth's seawater contains 0.008 mg gold/cubicmeter. The total quantity of gold would be 11 billion tons.

sneekula 969 Nearly a Posting Maven

Would so called 'cold fusion' , like deuterium trapped in certain metals, ever have a chance to be realistic?

sneekula 969 Nearly a Posting Maven

Soon in a Theater near you .....

sneekula 969 Nearly a Posting Maven

Another bumpersticker seen in one of the fancy subs North of Detroit:

sneekula 969 Nearly a Posting Maven

I like to see water polo with real horses.

sneekula 969 Nearly a Posting Maven

San Diego California has the nicest weather in the USA. When the big one comes, it will fall into the ocean, so what!

sneekula 969 Nearly a Posting Maven

You can't think of space having an end. Imagine people haden't discovered that the earth was round, and somebody decided to go for a VERY long walk.. and eventually finds himself back where he origanally set off, he would be very confused and unable to think of an answer to what had happened. Thats why if you set off to space in one direction, you could somehow find yourself back where you started, without an explanation.

Space, like time, has no beginning and no end. Might as well get used to it.

Where has all the time gone?

Does God have a beginning or an end?

sneekula 969 Nearly a Posting Maven

There is a code snippet that vegaseat left at:
http://www.daniweb.com/code/snippet452.html

He talks a little bit about the history of Python's sort() algorithm and calls it an adaptive mergesort algorithm. Very highly optimized, very fast and very stable, it is part of the interpreter core written in C. You would have to get the readily available C source code and look for it.

sneekula 969 Nearly a Posting Maven

I took the idea of multiple buttons layout from vegaseat's little wxPython calculator ( http://www.daniweb.com/forums/post648463-31.html ) and applied it to form a periodic table. You can easily expand the element dictionary to pack more practical information into this program:

# create a Periodic Table with multiple wxButton() widgets

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, mytitle, list_pt1, list_pt2):
        wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, pos=(0,20),
        size=(640, 330))
        self.SetBackgroundColour('green')

        # main sizer
        vsizer = wx.BoxSizer(wx.VERTICAL)

        # wx.GridSizer(rows, cols, vgap, hgap)
        # sizer for standard periodic table elements
        gsizer1 = wx.GridSizer(8, 18)

        font = wx.Font(10, wx.MODERN, wx.NORMAL, wx.BOLD)
        self.buttons1 = []
        for ix, symbol in enumerate(list_pt1):
            # forms a list of button objects, make certain id is unique
            btn_id = 100 + ix
            label = symbol
            self.buttons1.append(wx.Button(self, btn_id, label))
            self.Bind(wx.EVT_BUTTON, self.clickedButton, id=btn_id)
            self.buttons1[ix].SetFont(font)
            if symbol == " ":
                self.buttons1[ix].SetBackgroundColour("green")
            else:
                self.buttons1[ix].SetBackgroundColour("yellow")
            # the gridsizer fills left to right one row at a time
            gsizer1.Add(self.buttons1[ix], 0, wx.ALL|wx.EXPAND, border=1)

        # sizer for Lanthanides and Actinides
        gsizer2 = wx.GridSizer(3, 15)

        self.buttons2 = []
        for ix, symbol in enumerate(list_pt2):
            # forms a list of button objects, make certain id is unique
            btn_id = 300 + ix
            label = symbol
            #print label, ix, btn_id  # testing
            self.buttons2.append(wx.Button(self, btn_id, label))
            self.Bind(wx.EVT_BUTTON, self.clickedButton, id=btn_id)
            self.buttons2[ix].SetFont(font)
            self.buttons2[ix].SetBackgroundColour("pink")
            self.buttons2[ix].ClearBackground()
            # the gridsizer fills left to right one row at a time
            gsizer2.Add(self.buttons2[ix], 0, wx.ALL|wx.EXPAND, border=1)

        vsizer.Add(gsizer1, 0, wx.EXPAND)
        # spacer
        vsizer.Add((0, 30), 0, wx.EXPAND)
        vsizer.Add(gsizer2, 0, wx.EXPAND)
        #self.SetSizerAndFit(vsizer)
        self.SetSizer(vsizer)

    def clickedButton(self, event):
        # get the event id and then the …
sneekula 969 Nearly a Posting Maven

:-/ I have never tasted quiche...

It's a French dish, sort of like a pie with cheese, eggs, onions, spinach and so on. Can taste real good.

sneekula 969 Nearly a Posting Maven

The city with the most Rolls Royces per capita is Hong Kong.

sneekula 969 Nearly a Posting Maven

Errors have been made.
Others get the blame.

sneekula 969 Nearly a Posting Maven

I like to see people running and jumping.

sneekula 969 Nearly a Posting Maven

My Republican neighbor's car sticker:

sneekula 969 Nearly a Posting Maven

I think war is a dangerous place.
--George W. Bush, Washington, DC, 05/07/2003

sneekula 969 Nearly a Posting Maven

Two slices of oatnut bread loaded with Braunschweiger. The usual mug of Guatemalan coffee heavy on the cream.

sneekula 969 Nearly a Posting Maven

Please supply a reference for your toilet paper posting. I was there in 71 and I did not receive cam toilet paper, nor can I find a reliable reference to it on the net.

The reference is "Uncle John's Unstoppable Bathroom Reader, 16th Edition". According to it, the cam paper was issued to frontline scouts, because the Viet Cong had a habit to easily spot the white paper sticking out of the droppings. How is that for Yankee ingenuity!

sneekula 969 Nearly a Posting Maven

De-generated all the way. ;-)

Generation D was not in the list.

sneekula 969 Nearly a Posting Maven

Scrambled eggs and mushrooms.
Got to use up my portabella mushrooms.
Besides, my girlfriend likes what I cook.

sneekula 969 Nearly a Posting Maven

Something like this will do:

#! usr/bin/env python

import pygame
from pygame.locals import *

pygame.font.init

pygame.init()

screen = pygame.display.set_mode((150, 150))
pygame.display.set_caption('Help')
pygame.mouse.set_visible(0)
pygame.display.init()

lives = 3

def main():
    global lives
    font = pygame.font.Font(None, 36)
    s = "Lives =" + str(lives)
    text = font.render(s, 1, (250, 250, 250))
    screen.blit(text, (0, 0))
    pygame.display.flip()
    # run event loop and provide exit conditions
    while True:
        for event in pygame.event.get():
            # window title 'x' click
            if event.type == pygame.QUIT:
                raise SystemExit

main()
sneekula 969 Nearly a Posting Maven

The wx.grid.Grid() widget lets you present tabular data in an organized fashion, very similar to the popular spreadsheet programs. Here is a short example of it's use:

# a practical use of wxPython's wx.grid.Grid() widget
# load the grid via a list of lists
# bind cell select (mouse left click)

import wx
import wx.grid

class MyGrid(wx.grid.Grid):
    def __init__(self, parent, data_list):
        wx.grid.Grid.__init__(self, parent, wx.ID_ANY)
        self.parent = parent

        # set the rows and columns the grid needs
        self.rows = len(data_list)
        self.cols = len(data_list[0])
        self.CreateGrid(self.rows, self.cols)

        # set some column widths (default is 80) different
        self.SetColSize(0, 180)
        self.SetColSize(3, 100)
        self.SetRowLabelSize(40)  # sets leading row width

        # set column lable titles at the top
        for ix, title in enumerate(data_list[0]):
            self.SetColLabelValue(ix, title)

        # create reusable attribute objects
        self.attr = wx.grid.GridCellAttr()
        self.attr.SetTextColour('black')
        self.attr.SetBackgroundColour('yellow')
        #self.attr.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))

        # select the cell with a mouse left click
        self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.onCellLeftClick)

        self.loadCells(data_list)

    def onCellLeftClick(self, event):
        row = event.GetRow()
        col = event.GetCol()
        self.parent.SetTitle("row=%d  col=%d  value=%s" %
            (row, col, self.GetCellValue(row, col)))
        # move the grid's cursor to frame the cell
        self.SetGridCursor(row, col)

    def loadCells(self, data_list):
        # note that title row is taken
        for row in range(1, self.rows):
            # set cell attributes for the whole row
            self.SetRowAttr(row-1, self.attr)
            for col in range(self.cols):
                value = data_list[row][col]
                self.SetCellValue(row-1, col, value)
                self.SetReadOnly(row-1, col, True)
                if col > 0:
                    self.SetCellAlignment(row-1, col,
                        wx.ALIGN_RIGHT, wx.ALIGN_CENTRE)

        self.SetCellTextColour(row, 0, 'red')
        self.SetCellBackgroundColour(row, 0, 'white')
        self.SetCellFont(row, 0, wx.Font(8, wx.ROMAN, wx.ITALIC, wx.NORMAL))
        honor = "University of Detroit Chemistry Department"
        self.SetCellValue(row, 0, honor)


# build the data_list, raw_data string is from a …
sneekula 969 Nearly a Posting Maven

Why do the US Republicans have an elephant and the US Democrats a donkey for their party symbol?

sneekula 969 Nearly a Posting Maven

Toilet paper can tell you a lot about a country:

Every sheet of such paper on the German railroad has "Deutche Bundesbahn" stamped on it.

Government museums in Britain show "Official Government Property" on every sheet.

During the Viet Nam war the US Military issued camouflage toilet paper.

sneekula 969 Nearly a Posting Maven

Here is a cute one I found not too long ago.

sneekula 969 Nearly a Posting Maven

As quoted by Dennis Ritchie:
"UNIX is simple. But It just needs a genius to understand its simplicity."

sneekula 969 Nearly a Posting Maven

May you be blessed by His Noodly Appendage!

You mean Poodly Appendage?
Dani should put you on the welcoming committee.

sneekula 969 Nearly a Posting Maven

The most common name in the world is Mohammed.

sneekula 969 Nearly a Posting Maven

Depression is caused by an imbalance of brain chemicals, not by the environment. There are billions of people on this earth that live in much worse circumstances than you, and yet they are not depressed and don't think of suicide.

Sometimes you can be treated with drugs to help you with the imbalance.

Right on! For a youngster you are pretty smart!

sneekula 969 Nearly a Posting Maven

Scrambled eggs and mushrooms.

sneekula 969 Nearly a Posting Maven

Speaking of taxes, check this out.
http://www.ananova.com/news/story/sm_2935937.html

Great idea! Hope the Holy Father (the Pope) is reading this! He sure could use the savings to do good and holy things.

sneekula 969 Nearly a Posting Maven

I just finished my keesh! Dropped some of it on my hiking boots.

sneekula 969 Nearly a Posting Maven

John McCain came to the Sturgis Bike Rally. I don't think Obama could find Sturgis. Even with Google Maps.

Oh yes he would find it, just follow the roar of freedom and the empty beer cans.

sneekula 969 Nearly a Posting Maven

If a man makes three correct consecutive guesses, does that make him an expert?

scru commented: haha +3
sneekula 969 Nearly a Posting Maven

Equal opportunity means that everyone will have a fair chance at being imcompetent.