try creating a TIC TAC TOE game (or a X and 0 game).

Starting with the following card game code:

'''CardGame_draw_five1.py
create a deck of cards, shuffle and draw a hand of five cards
rank: ace=A, 10=T, jack=J, queen=Q, king=K, numbers=2..9
ace of spade would be AS, 8 of heart would be 8H and so on ...
'''

import random

def create_deck():
"""
create a full deck of cards as a list of codes
"""
ranks = "A23456789TJQK"
suits = "CDHS"
cards = [rank + suit for rank in ranks for suit in suits]
return cards

def shuffle_deck(cards):
random.shuffle(cards)
return cards

def draw_5cards(cards):
"""
pop five cards of the end of the cards list
return a list of cards shorten by those cards
and a list of the 5 cards
"""
hand5 = cards[len(cards)-5:]
# shorten the deck by these 5 cards
del cards[len(cards)-5:]
cards_left = len(cards)
if cards_left < 5:
cards = create_deck()
cards = shuffle_cards(cards)
print "A new deck of cards has been shuffled!"
return cards, hand5

cards = create_deck()
cards = shuffle_deck(cards)
print("Cards in deck = %d" % len(cards))  # test
cards, hand5 = draw_5cards(cards)
print("Cards in deck = %d" % len(cards))  # test
print("Five cards drawn:")
print(hand5)
print("Five cards sorted by rank:")
hand5rank = sorted(hand5, key=lambda x: x[0])
print(hand5rank)
print("Five cards sorted by suit:")
hand5suit = sorted(hand5, key=lambda x: x[1])
print(hand5suit)

'''possible result -->
Cards in deck = 52
Cards in deck = 47
Five cards drawn:
['AH', '4C', 'TS', '6H', '7C']
Five cards sorted by rank:
['4C', '6H', '7C', 'AH', 'TS']
Five cards sorted by suit:
['4C', '7C', 'AH', '6H', 'TS']
'''

Write code to evaluate if you have a valid poker hand.

commented: nice approach +14

This is a simple text editor using the Python GUI toolkt PySide:

'''ps_TextEdit_simple_editor1.py
use PySide's QTextEdit and QFileDialog to form a simple
text editor

click right mouse button in edit area for popup menu
for undo, cut, copy. paste, select All, etc.

PySide is the official LGPL-licensed version of PyQT
PySide is available for Windows and UNIX machines
for Python27: PySide-1.1.0qt474.win32-py2.7.exe
for Python32: PySide-1.1.0qt474.win32-py3.2.exe
from:
http://developer.qt.nokia.com/wiki/PySide_Binaries_Windows
'''

from PySide.QtCore import *
from PySide.QtGui import *

class MyFrame(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
# setGeometry(x_pos, y_pos, width, height)
self.setGeometry(100, 50, 600, 350)
self.setWindowTitle('A simple editor using PySide')

self.edit = QTextEdit(self)
self.save_button = QPushButton(self)
self.save_button.setText('Save text file')
self.info_label = QLabel(self)
s = "click right mouse button in edit area for popup menu"
self.info_label.setText(s)

# use grid layout manager
grid = QGridLayout(self)
# addWidget(QWidget, row, column, rowSpan, columnSpan)
self.setLayout(grid)

# bind the button clicked to action
# newer connect style used with version 4.5 or higher
self.save_button.clicked.connect(self.save_file)

"""
load the selected filename and display in QTextEdit
get the file name via QFileDialog.getOpenFileName()
"""
caption = 'Open file'
# use current/working directory
directory = './'
filter_mask = "Python/Text files (*.py *.pyw *.txt)"
filename = QFileDialog.getOpenFileName(self,
print(filename)  # test
with open(filename) as fin:
self.edit.setPlainText(text)
self.setWindowTitle(filename)

def save_file(self):
"""
save text in QTextEdit to a file
"""
caption = 'Save file'
# use current/working directory
directory = './'
filter_mask = "Python/Text files (*.py *.pyw *.txt)"
filename = QFileDialog.getSaveFileName(self,
print(filename)  # test
with open(filename, "w") as fout:
text = self.edit.toPlainText()
fout.write(text)
self.setWindowTitle(filename)

app = QApplication([])
frame = MyFrame()
frame.show()
app.exec_()

See if you can embelish this code by introducing a find/replace text function.

commented: +1 for PySide +14

Write a Python program the finds the longest word in a given text string.

This are the 100 most popular names given to baby girls in the US from 1900 to 1910:
Mary,Helen,Margaret,Anna,Ruth
Elizabeth,Dorothy,Marie,Florence,Mildred
Frances,Rose,Annie,Grace,Bertha
Emma,Bessie,Clara,Hazel,Irene
Gertrude,Louise,Catherine,Martha,Mabel
Pearl,Edith,Esther,Minnie,Myrtle
Ida,Josephine,Evelyn,Elsie,Eva
Thelma,Ruby,Agnes,Sarah,Viola
Nellie,Beatrice,Julia,Laura,Lillie
Lucille,Ella,Virginia,Mattie,Pauline
Carrie,Alma,Jessie,Mae,Lena
Willie,Katherine,Blanche,Hattie,Marion
Lucy,Stella,Mamie,Vera,Cora
Fannie,Eleanor,Bernice,Jennie,Ann
Ellen,Kathryn,Maggie,Doris,Dora
Betty,Marguerite,Violet,Lois,Daisy
Maude,Marjorie,Opal,Hilda,Velma

... and these are the names for the years 2000 to 2010:
Olivia,Ashley,Samantha,Alexis,Sarah
Elizabeth,Isabella,Alyssa,Grace,Lauren
Taylor,Jessica,Brianna,Kayla,Sophia
Anna,Natalie,Victoria,Chloe,Sydney
Jasmine,Hailey,Megan,Rachel,Morgan
Julia,Destiny,Ava,Jennifer,Kaitlyn
Mia,Katherine,Alexandra,Haley,Savannah
Nicole,Maria,Allison,Mackenzie,Stephanie
Brooke,Amanda,Ella,Makayla,Faith
Kaylee,Jenna,Andrea,Katelyn,Mary
Kimberly,Trinity,Zoe,Michelle,Sara
Lily,Kylie,Alexa,Caroline,Vanessa
Amber,Angelina,Gabriella,Lillian,Riley
Erin,Maya,Ariana,Audrey,Isabel
Sofia,Marissa,Bailey,Jacqueline,Melissa
Claire,Evelyn,Shelby,Jocelyn,Mariah
Avery,Leslie,Melanie,Arianna,Aaliyah

Write a Python program that finds any names that are still popular over a hundred year span.

Write a Python program that compares two text strings and gives a percent rating how well they match.

One hint ...

'''str_set_xor1.py
show the words that are in one text or the other
but not in both
'''

text1 = """\
its fleece was white as snow
and everywhere that Mary went
the lamb was sure to go"""

text2 = """\
Mary has a little lamp
his fleece as white as snow
and where ever that Mary went
the lamp is sure to go"""

# create a set of unique words for text1
set1 = set(text1.split())
# dito for text2
set2 = set(text2.split())

# create a new set with words in either
# set1 or set2 but not both (exclusive or)
set_xor = set1.symmetric_difference(set2)

# show result
print("%d words are different" % len(set_xor))
print('-'*22)
for word in set_xor:
print(word)

'''result ...
11 words are different
----------------------
his
was
is
everywhere
its
lamb
where
lamp
has
ever
'''

Given an amount of less than one Dollar/Euroes, write a Python program to represent this amount such that the least amount of common coins are used.

Write a generator that produces the following sequence:
1,2,3,4,5,10,20,30,40,50,100,200,300,400,500

Write a custom wordwrap function for a text with long lines.

A good Project for the mid-way between beginner and intermediate is blackjack. It will get you used to most functions, list, objects, and depending on how serious you want it to be, GUI.

Assume you have filed all your code snippets into one directory. Write a Python program that searches this directory for keywords and brings up the names of the files that contain these keywords.

Control a turtle graphics canvas (module turtle) from an external Tkinter window with buttons.

Assume you have a list of unique integers, write a program that will show the closest pair or pairs.

You can use the Python third party module SimpleCV from:
http://www.simplecv.org/
To do Computer Vision experiments leading to rather interesting projects.

Create a function that shifts elements of a list in circular order.
For instance [1,2,3,4,5] --> [5,1,2,3,4] etc.

Using a Python GUI tookit like Tkinter write a numeric seven segment LED display like the ones on your alarm clock.

Write a Python program that finds the smallest number that can be divided by each of the numbers from 1 to 10 without leaving a remainder.

Compare texts and see which ones are a close match.
Work out a degree/percentage of match.

If you have a room with 16 people, how many times can they shake hands once with each other?

How about you try to make a calculator to find the chances of landing somewhere on monopoly from you location. What are the chances of getting from Mayfair to Liverpool Street Station in one turn?

In Tkinter programme a periodic table where if you click an element it gives you more info.

commented: Not so bad idea! +12
commented: Great idea, I'll definitely try this. +0

Use Tkinter to make a game similar to Pokemon with attacks and items.

Have a look at pygame

Work up to an final goal

You have two strings that look much alike:
waterkraftownermanuals

Write Python program that will highlight the differences by capitalizing the characters that don't match:
waTerKraftownermanualS