game.py

My first own functional python script is ready. It’s a simple game.

If you have pointers how to make it better, please do write em. I’m eager to learn.


# -*- coding: cp1252 -*-
import random

running = True
r = random.randrange(65,90)
r_chr = chr(r)
while running:
	print "Numeric value for ASCII '" + r_chr + "'?"
	try:

		a = input("Your answer: ")
		if chr(a) == r_chr:
			print "Correct! " + r_chr + " is", a
			running = False
		else:
			print "Wrong... Try again."
			running = True

	except NameError:
		print "You didn't provide a good numeric value."
	except KeyboardInterrupt:
		print "Shutting down..."
		running = False
		quit()
	except:
		print "Something went wrong..."
		running = False
		quit()

The game: Learn the numerical values of ASCII uppercase letters. — Why? I don’t know.

The 5th day after reading first things about python, 2nd day actually learning and writing it.

Hello Python!


number = 5
print number
number = number + 1
print number
multiline = '''This is the first line.
And this is the second.
'''
print multiline
Yay! Baby steps, I know, but gotta start from somewhere.

PHP 101: PHP For the Absolute Beginner »

This area is intended for everyone new to PHP. It opens with a series of informal, entertaining tutorials written by Vikram Vaswani, founder and CEO of Melonfire.

Covers the basics of PHP using easy to follow examples and detailed descriptions what is happening in the code.

Must read to all who want to learn and understand the basics.

Upgrading PEAR on Debian

After trying hard to upgrade PEAR 1.3.2 to latest with the build in upgrade tool

pear upgrade pear

on my own Debian 3.1 (Sarge) I got the following error message so many times I can’t count:

pinion:/# pear upgrade PEAR
downloading PEAR-1.4.11.tgz ...
Starting to download PEAR-1.4.11.tgz (283,272 bytes)
..........................................................done: 283,272 bytes
requires package `PEAR' >= 1.3.3

And

Segmentation fault

I came across this workaround:

pear upgrade http://pear.php.net/get/PEAR-1.3.3.tgz
pear upgrade Archive_Tar
pear upgrade PEAR
pear upgrade-all