DailyPhobias

DailyPhobias on viime vuoden lokakuussa kehitetty/aloitettu projekti, jonka ainoa idea on lähettää automaagisesti twitteriin fobian nimi ja kuvaus.

Opin enemmän OAuth-menetelmästä jonka Twitter nykyään vaatii automaagisiin palveluihin ja Pythonin saloista. Loppujen lopuksi tein projektin loppuun PHP:llä ja MySQL:llä, koska en ymmärtänyt Pythonin MySQL-käyttöä tarpeeksi nopeasti. Joku toinen kerta sitten.

Alkaa todo-lista tyhjentyä turhista asioista joilla ei ole mitään väliä, mutta häiritsevät siellä kuitenkin.

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.