I touched these up in Photoshop, i.e., straightened, curves, levels, hue/sat, unsharp mask…
Fun with strings and the “for” loop
I was asked to take this code:
prefixes = "JKLMNOPQ"
suffix = "ack"
for letter in prefixes:
print letter + suffix
which produced the following output:
Jack
Kack
Lack
Mack
Nack
Oack
Pack
Qack
and rewrite it so that Oack and Qack would actually be Ouack and Quack. Here is what I did:
prefix = 'JKLMNOPQ'
suffix = 'ack'
for letter in prefix:
if letter == 'Q' or letter == 'O':
print letter + 'u' + suffix
else:
print letter + suffix
Here was the result:
Jack
Kack
Lack
Mack
Nack
Ouack
Pack
Quack
Yay! I’m going to revisit it though and see if there is a better way of coding it. For now, I’m just happy it worked.
Posted in python |
2 Comments »
Running at lunch
I’ve been experimenting with my running schedule over the last few months. My latest thing is to run on my lunch break. Since I eat constantly throughout the day and never really stop for a conventional lunch, this seems to make a lot of sense. I can leave work, run three miles, take a shower, and be back at work in just under an hour.
Another great benefit of running at lunch is that it energizes me for the rest of the day. Usually, come two o’clock, I start feeling a little sluggish, but after a nice run I’m ready to go.
On a side note, I’m making a spaghetti meat sauce tonight and I am going to add Goya black beans into the mix. Just thought I’d throw that out there.
Posted in health |
No Comments »
Boston Sunset
I added the frame using Flickr Toys @ http://bighugelabs.com/flickr
Posted in photo |
No Comments »
Writing prompts: object in the room
I’ve decided to try some writing prompts to jump start my imagination. There are some great creative writing prompts at this website: www.creativewritingprompts.com This will be my first attempt at this, so don’t laugh. This particular prompt asks me to close my eyes and think about an object in the room. After about three minutes of concentrating on the object, I am to open my eyes and write about it without looking at it. This should be interesting….
It’s a vase. It sits on top of my armoire, under a large lamp, and doubles as a bookend. I’ve had this vase for as long as I can remember, yet I don’t know where it came from. It stands about 8 inches tall and is approximately 4 inches across at it’s widest point, which happens to be its middle section. The top of the vase is almost as wide as the middle, but it curves out over itself to form a sort of lip around the rim. It’s rough to the touch, as if sand was mixed in to the ceramic, and has a distinct ribbed feeling. It’s made up of various shades of brown, and the décor reminds me of those souvenirs of oddly blown glass, filled with layers of colored sand. I always thought it would look at home on a ranch in Arizona or Colorado. Even though it’s a vase, I’ve never actually put flowers in it. It has, however, been known to contain a book or two of matches, and it also acts as a temporary holding place for my daughter’s baby teeth, once the tooth fairy makes her rounds. Most of the time it goes unnoticed, but every now and then it catches my eye. When it does, I’m always glad it’s there.
Posted in writing |
1 Comment »
My first functions
Here are some of the functions I created for my exercises. They may not be the most efficient way of coding them, but they all seem work.
I tested the isPrime() function with the number 2**70 and it was well over 5 minutes before I got a return result. I’ll have to look in to how to speed that up.
#a simple compare function
def compare(x,y):
if x > y:
return 1
if x < y:
return 0
else:
return -1
#determines if a number is even
def isEven(x):
if x % 2 == 0:
return True
else:
return False
#determines if a number is odd
def isOdd(y):
even = is_even(y)
if even == True:
return False
else:
return True
#determines if f is a factor of n
def isFactor(n,f):
if n%f == 0:
return True
else:
return False
#determines if m is a multiple of n
def isMultiple(n,m):
if m%n == 0:
return True
else:
return False
#finds the common multiple of 2 numbers
def comult(x,y):
if type(x) != int or type(y) != int:
'''Guardian code'''
print "numbers only please"
return
if x == 0 or y == 0:
print "please enter a number greater than zero"
return
'''End guardian code'''
num = 0
remainder = 1
while remainder != 0:
num = num + 1
remainder = (x * num) % y
return (x * num)
#lists power of 2 up to 2**16
def powof2():
x = 2.0
while x < 65536.0:
print x, ' ', '\t', x * 2
x = x * 2.0
#prints multiples of number n up to number high
def print_multiples(n, high):
i = 1
while i < = high:
print n*i, '\t',
i = i + 1
print
#prints a multiplication table up to number high
def print_mult_table(high):
i = 1
while i < = high:
print_multiples(i, i)
i = i + 1
#prints n newlines using the while condition
def n_lines(n):
i = 1
while i < = n:
print
i = i + 1
#determines if n is a prime number
def isPrime(n):
i = n - 1
while i > 1:
rem = n % i
if rem == 0:
return False
else:
i = i - 1
return True
#prints all prime numbers between 1 and x
def morePrime(x):
i = 1
while i < = x:
if isPrime(i) == True:
print i, " is a prime number"
i = i + 1
#prints all prime numbers between x and y
def evenMorePrime(x,y):
if x > y:
x,y = y,x
i = 1
print “Finding all prime numbers between “, x, ” and “, y
print
while x < = y:
if isPrime(x) == True:
print x, " is a prime number"
x = x + 1
Posted in python |
4 Comments »
Two great translation sites
When I hear a word or a phrase that I would like to know how to spell, I usually go to one of these two sites for translation.
http://www.rustran.com
or more recently I’ve discovered
http://translation2.paralink.com
Both are great, and a lot of times I will compare the results of each site to insure accuracy.
Posted in russian |
No Comments »
The Zen of Running
I try to find multiple positives in everything I do. For instance, Leo over at Zen Habits wrote a post called The Zen of Running.
He talks about how to combine running with some good old fashioned concentration and contemplation techniques. It made sense to me, so I laced up and gave it a whirl. I really enjoyed it.
I ran twice this week so far. Last night for a little over twenty minutes and tonight for about 30 minutes. It felt good.
Posted in health, zen mind |
No Comments »
How to think like a computer scientist
I have been reading the tutorial “How to Think Like a Computer Scientist”
I highly recommend it.
Posted in python |
No Comments »



