Skip to content

Instantly share code, notes, and snippets.

Created January 7, 2015 23:01
Show Gist options
  • Save anonymous/001a249afa518df14d3c to your computer and use it in GitHub Desktop.
Save anonymous/001a249afa518df14d3c to your computer and use it in GitHub Desktop.
List of newbie programming projects
Here's from a file I made a whilst ago when teaching someone python. They're roughly in order of easyness to implement (in python), from top to bottom. Towards the end it's just a big brain dump. We got through a good number of them, but never into the fun ncurses based games :'(
#. something that draws a triangles in a command prompt?
*
**
***
****
*****
******
*
**
***
****
***
**
*
*
***
*****
*******
*********
***********
#. Grading Program http://www.cplusplus.com/forum/articles/12974/
#. Cola Machine http://www.cplusplus.com/forum/articles/12974/
#. While( user == gullible ) http://www.cplusplus.com/forum/articles/12974/
#. Bracketing Search (number game!) http://www.cplusplus.com/forum/articles/12974/
#. Pancake Glutton http://www.cplusplus.com/forum/articles/12974/ (don't do sort yet?)
#. Fun with Functions http://www.cplusplus.com/forum/articles/12974/
#. make a robust input function
#. str is a sequence type. use the list/sequence type methods on string. see if they make sense to you
#. simple program that takes a name on the command line and says hello to it
#. Cowsay!!!
#. fish tank volume
> python fishtankvolume.py 30 40 10
width is 30cm
height is 40m
depth is 10cm
volume is 30 * 40 * 10 cm = 12000
bonus for printing 120m
#. sum numbers on command line
> python fishtankvolume.py 1 2 3
total is 6
> python fishtankvolume.py 10 10 10 10 10 10 1
total is 61
#. something that draws an ascii calendar
this might be quite difficult? do it later
try designing the program on paper / in a comment first
need to know about sys.argv etc?
> python3 calendar.py 3 28 "Febuary"
( first arg is the day to start on. monday = 1, sunday = 7;
second arg is the number of days in the month. >28, <31;
thid arg is the title to print
------------------------
| FEBUARY |
+----------------------+
| Mo Tu We Th Fr Sa Su |
| 01 02 03 04 05 |
| 06 07 08 09 10 11 12 |
| 13 14 15 16 17 18 19 |
| 20 21 22 23 24 25 26 |
| 27 28 |
------------------------
bonus: take another argument that higlights the day with
> python3 calendar.py 3 28 19 "Febuary"
( first arg is the day to start on. monday = 1, sunday = 7;
second arg is the number of days in the month. >28, <31;
third arg is the day to highlight
fourth arg is the title to print
--------------------------------
| FEBUARY |
+------------------------------+
| Mo Tu We Th Fr Sa Su |
| 01 02 03 04 05 |
| 06 07 08 09 10 11 12 |
| 13 14 15 16 17 18 _19_ |
| 20 21 22 23 24 25 26 |
| 27 28 |
--------------------------------
bonus bonus: do it using bold char and ascii box chars and colours?
(use https://pypi.python.org/pypi/colorama , which I've installed for you
and possibly https://pypi.python.org/pypi/termcolor , which I've also installed for you
just put:
import colorama
colorama.init()
at the top of a python file.
need to run it from pycharm's "terminal" or a normal windows cmd to actually see color
the debugger output doesn't show coloured text :(
#. string stuff:
string formatter
escape sequence
slices?
common string methods
roll you own string formatter?!?!?!
# Simple Pirate game.
GIST NOTE: I can't remember what this is. I think it was a simple game, either command prompt style or curses style, that had you choose to persue + attack or avoid passing ships, and occasionally go to port to sell booty and get supplies etc. Or possibly just buy/sell goods at different ports with the option to attack if you had guns.
# A simple use of dict, e.g. a telephone number lookup service. (both name-> num and num->name)
#. Reverse a string
(both using the stdlib function and reimplementing it)
#. Hangman?
http://inventwithpython.com/chapter8.html + 9
#. rot13? Caesar cipher?
#. Pig Latin
Pig Latin is a game of alterations played on the English language game.
To create the Pig Latin form of an English word the initial consonant sound is transposed to the end of the
word and an ay is affixed (Ex.: "banana" would yield anana-bay). Read Wikipedia for more information on rules.
#. Count Vowels
Enter a string and the program counts the number of vowels in the text. For added complexity have it report a sum
of each vowel found.
#. Check if Palindrome
Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards
like “racecar”. (Also, should work on words with spaces? e.g. "A new order began, a more Roman age bred Rowena.")
#. Count number of words and lines in a string/file?
need to read a file.
also do stdin instead?
#. Roman Numerals conversion program?
function to convert from string roman to int
function to convert from int to string roman
text from book:
In order to test your program, read a Roman number string from the first
command line argument, convert it to an integer, and then using a
loop, print that integer number and the next 19 numbers, each with its Roman number equivalent.
The program may assume that the argument is a legal Roman Number. Here is an example
$ python RomanNumberTest MMIX
Roman for 2009 is MMIX
Roman for 2010 is MMX
Roman for 2011 is MMXI
Roman for 2012 is MMXII
Roman for 2013 is MMXIII
Roman for 2014 is MMXIV
Roman for 2015 is MMXV
Roman for 2016 is MMXVI
Roman for 2017 is MMXVII
Roman for 2018 is MMXVIII
Roman for 2019 is MMXIX
Roman for 2020 is MMXX
Roman for 2021 is MMXXI
Roman for 2022 is MMXXII
Roman for 2023 is MMXXIII
Roman for 2024 is MMXXIV
Roman for 2025 is MMXXV
Roman for 2026 is MMXXVI
Roman for 2027 is MMXXVII
Roman for 2028 is MMXXVIII
The Roman number system
In Roman numbers, there is no zero, nor any negative number. There are 7 digits and 6 pairs of digits,
with values as follows.
Digit Value Digit pair Value
M 1000 CM 900
D 500 CD 400
C 100 XC 90
L 50 XL 40
X 10 IX 9
V 5 IV 4
I 1
These are placed next to each other, with largest values on the left, and smallest on the
right. The number represented is simply the sum of the values of the digits and digit pairs.
The sample output from the test program (above) shows examples. Notice how each digit pair consists of a
digit followed by a greater valued digit, and that the value is the value of the greater minus the value of the
lesser. E.g. the value of "CM" is 1000 − 100. Perhaps contrary to your intuition, the Romans did not have other
pairs than these 6. One cannot write "MIM" to mean 1999, instead it is written as
"MCMXCIX" : 1000 plus 900 plus 90 plus 9
12.5.2 How to convert to and from Roman numbers
To convert a Roman number into an integer, we can scan the characters in the String
from left to right and add the values of the characters to the int number being thus accumulated.
So we start this accumulation with the value zero. However, if the value of any
character is greater than that of the previous one, then we have just had the second character
of a digit pair. In this case we subtract the value previously added, twice, and then
add the value of this character. You may wish to treat the ?rst character of the Roman
number String differently from the others, as it has no previous one. For all the other
characters, we shall compare the value with the value of the previous character. Some
examples follow.
Roman Decimal
XIV X I V
10 +1 (-2 +5) 14
CDXLIV C D X L I V
100 (-200 +500) +10 (-20 +50) +1 (-2 +5) 444
CMXCIX C M X C I X
100 (-200 +1000) +10 (-20 +100) +1 (-2 +10) 999
MIM M I M
1000 +1 (-2 +1000) 1999
Notice that the last line is an illegal Roman number string, yet the algorithm suggested
will still produce a result, and effectively behaves as though "IM" actually is a legal digit
pair with the value 999. As said above, you may assume your constructors are not given
illegal strings, so there is no need for you to write code that checks legality.
Converting an integer into a Roman number is a little easier. We accumulate the sequence
of Roman digits in a result String, starting with an empty string, as follows. While the
number is greater than or equal to 1000, subtract a 1000 from it and append "M" to the
result. Now do this for 900 with "CM", 500 with "D", 400 with "CD" and so on.
#. data structures (list, tuple, hash)?
#. implement random.shuffle
#. a simple total accumulator
> python totaliser.py
Enter numbers, "SUBTOTAL", "TOTAL" or "QUIT"
> 10
> 20
> subtotal
total so far is 30
> 5
> total
final total is 35
> 5
> 4
> subtoal
total so far is 9
> 10
> quit
final total is 19
bye! x
#. a simple calculator (input from command line?)
e.g.
> python calc.py "2 + 3 / 5"
answer is 2.6
or maybe it should be interactive?
> python calc.py
>>> 2 + 2
= 4
>>> 4 * 8
= 32
>>> $ + 4 # $ is the value of the last expression
= 36
or maybe it'd be easier to do prefix?
> python prefixcalc.py
>>> + 2 2
= 4
>>> + 2 2 2 2 #arbitrary length! :)
= 8
>>> + $ 4
= 12
>>> * (+ 2 2) 5 # same as (2 + 2) * 5. parens required?
= 20
>>> (+ 2 2)
= 4
>>> (+ $ 6)
= 10
#. tip calculator
person starts program
inputs a list of items with their prices
enters "calculate 10%"
gets total + tip
(bonus: works out max, min, average food item price.
given a number of people, works out how much they should pay)
#. Someting that takes a big interactive list as input and reverses it
bonus: if you did it using a python list, do it manually
bonus: if you did it manually, use a python list, do it
##. Quiz Maker
Make an application which takes various questions form a file, picked randomly, and puts together a quiz for
students. Each quiz can be different and then reads a key to grade the quizzes.
##. pangolins/20 questions
binary trees!
##. a proper text adventure game
actual structures!
(use ncurses for next few things?)
http://inventwithpython.com/chapters/
http://inventwithpython.com/extra/ gorillas.py
##. game of life?
##. minesweeper?
##. sudoku
suodku solver?
##. Tic Tac Toe http://www.cplusplus.com/forum/articles/12974/
* just allow uses to enter X or O
* then make it say who won
* add AI?!
##. Basic Dungeon Crawl http://www.cplusplus.com/forum/articles/12974/
(get to exit without falling down holes)
then add walls/corridors?
then random generation of those things?
then add monsters?
##. Mastermind
##. Frogger
##. Crossword Puzzle
##. Hangman
##. snake
##. tetris
##. breakout
##. minesweeper
##. Battleship
##. Chess and Checkers
##. NCRUSES match3, aka a version of JELLY SPLASH / CANDY CRUSH SAGA / etc
##. Galcon? Platform game?
##. Movie Store
Manage video rentals and controls when videos are checked out, due to return, overdue fees and for
added complexity create a summary of those accounts which are overdue for contact.
Also the store should be able to buy in more videos, lose stock etc
##. Airline / Hotel Reservation System
Create a reservation system which books airline seats or hotel rooms. It charges various rates
for particular sections of the plane or hotel. Example, first class is going to cost more than coach.
Hotel rooms have penthouse suites which cost more.
Keep track of when rooms will be available and can be scheduled.
##. Bank account?
Many versions of code warrior game? (or: implement one! :P)
do everything else on http://www.cplusplus.com/forum/articles/12974/
simple http fetch > serialize to file
databases
2d graphics
3d graphics
catan board generator (using kivy)
note: there's not enough file stuff here?
nodes, graphs, heaps, sorts, breath-first-search etc
sockets? networks? intra-procedure stuff?
numpy array etc?
http://web.archive.org/web/20100808125507/http://cse.ucdavis.edu/~chaos/courses/nlp/Software/PythonProgramming.html
useful links:
http://docs.python.org/3.3/library/index.html
http://docs.python.org/3.3/tutorial/index.html
http://www.biotnet.org/sites/biotnet.org/files/pythonoverview_v1.0.pdf
http://www.biotnet.org/sites/biotnet.org/files/pythoncommands_v1.0.pdf
http://www.biotnet.org/sites/biotnet.org/files/pythonbasics_exercises_v1.0.pdf
http://www.upriss.org.uk/python/PythonCourse.html
http://www.cplusplus.com/forum/articles/12974/
http://studentnet.cs.manchester.ac.uk/ugt/2013/COMP16121/
http://studentnet.cs.manchester.ac.uk/ugt/2013/COMP16212/
http://studentnet.cs.manchester.ac.uk/ugt/2013/COMP16121/example-list-with-labs.pdf
http://www.cs.man.ac.uk/~jtl/JJIT/supportMaterial/
https://github.com/gregmalcolm/python_koans
http://www.pythonchallenge.com/pc/def/0.html
http://icpc.baylor.edu/challenge/
http://projecteuler.net/ ? pft
http://greenteapress.com/thinkpython/thinkCSpy/html/
http://www.nand2tetris.org/book.php 1!!!!!! :D
http://projecteuler.net/
http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/
http://programmingpraxis.com/
https://github.com/karan/Projects4 p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment