Task for beginners: Any task can be enhanced to be run as web application on localhost.
Sink the boat
Computer places boats randomly, you try to guess, computer answers 'miss' 'hit' 'kill' 'game over' - and evaluates your performance:how many moves you needed to sink all boat.
Simplified variant: "Suez canal": 1 boat (length 3) in 1D game field long 10 cells.
Scissor Paper Rock
Command window loop, with the computer asking for S P or R, and coming back with its gamble, and game statistics.
Enhancements:
- version which will win more often, but not always (like about 55%). Of course by cheating :-)
Custom web page extract
Write code to access a favorite webpage and extract some text from it. For example, access a weather site and extract the forecast top temperature for your town or city today.
Geo-quiz about 50 states/capitals
Use Google or other search engine to find some data file containing 50 US states and their capitals; download to your local drive; write a Python program to snarf this data into a dictionary. Write a short quiz loop to ask yourself the capitals.
data like data - solution - another
Enhancements:
- download data from a page, and parse
- 2-3 more quizes on other data (state motto, state bird) and also in different directions (bird->state)
- generic engine to run quizes
Translate text to leet speak ( 1337 )
Using regular expressions and substitution, where ``e` → 3, i → 1, o → 0, l → |, s → 5, . → 5w33t!, ate → 8. Normalize the text to lowercase before converting it. Add more substitutions of your own. Now try to map s to two different values: $ for word-initial s, and 5 for word-internal s.
Generator of random files
Using random number generator, create file (many lines) with words (separated by 1 or more spaces). Words consist of letters, digits, mixed, pure numbers, pure letters etc.
Parse file according to a rule
Parse file from previous exercise. Print only lines containing words which match certain rule, like: odd numbers, text of certain length, contains 2 'a's and no 'r's etc.
Generator of names of Kung-fu moves
like this one
Comments (0)
You don't have permission to comment on this page.