Tag Archives: python

Código para el Juego de Adivinar el Número

# Number-Guessing Game from Hello__World! ISBN-13: 978-1933988498
# Translated from English to Spanish :: Listing 1.2

import random

secret = random.randint(1, 99)
guess = 0
tries = 0

print "Hey, Yo soy el Pirata Pesadilla Roberto, y tengo un secreto!"
print "Es un numero entre el 1 y el 99. Y te dare 6 intentos para que adivines. "

while guess != secret and tries < 6:
    guess = input("Cual es el numero? ")
    if guess < secret:
        print "Muy bajo, cara de ajo! "
    elif guess > secret:
        print "Muy alto, marinerito de agua dukce!!"
    tries = tries + 1
if guess == secret:
    print "Avast! Lo hiciste!  Encontraste my secreto, si lo hiciste!"
else:
    print "No mas adivinanzas  Mas suerte la proxima vez!"
    print "El numero secreto fue", secret
Leave a Comment
Aside

Install EasyGUI on Mac OS X

Download EasyGUI if you have not done so already. In the directory where you downloaded the .tar file, follow the terminal commands below:

$ tar -xvf easygui_v0.95.tar
$ sudo python setup.py install

The ‘$’ should not be typed within the terminal window, as this refers to the privilege level. You could also copy “easygui.py” to “/Library/Python/2.7/site-packages/” directory.  To check if the module is installed within Python type:

Python Code:

>>> import easygui
>>> easygui.msgbox("Hello There!")

or

>>> help()
>>> easygui

control + D

Leave a Comment

The Littoral Cave

Sea cave are “formed primarily by the wave action of the sea”. This erosion is ongoing against host rocks and when there is a weak zone, caves start to form. One of my ‘wave action’ goals for 2012 is learning to program. Douglas Rushkoff author of Program or be Programmed: Ten Commands for a Digital Age candidly writes:

“In the emerging, highly programmed landscape ahead, you will either create the software or you will be the software.  It’s really that simple: Program, or be programmed. Choose the former, and you gain access to the control panel of civilization. Choose the latter, and it could be the last real choice you get to make.”

I choose not to just continue learning how to use programs but how to make them as well. Starting with Code Year, which sends interactive programming lessons each week. I have also started to read a few books for learning how to program in Python:

  1. Sande, Warren, and Carter Sande. Hello World!: Computer Programming for Kids and Other Beginners. Greenwich, CT: Manning, 2009. Print.
  2. Shaw, Zed A. Learn Python The Hard Way | A Beginner Programming Book. Web. 07 Jan. 2012. <http://www.learnpythonthehardway.org/>.
  3. Dawson, Mike. Python Programming for the Absolute Beginner. Boston, MA: Course Technology Cengage Learning, 2010. Print.

 

Leave a Comment

A Toast to the Magic Cave

This blog will bring a complex intermingling of technology genres and ideas that will intrigue us all; from simple reposting to in-depth write-ups.  Welcome to my cavern, or if your just learning to program in python:

Python 2.7 Code:

print “Hello World!”
Leave a Comment