Skip to content

Plutonic Rainbows

Percentage Calculator

This script will ask you to enter your amount and the percentage to be deducted before finally giving you the new amount.

# -*- coding: utf-8 -*-

def percentage(input_sum, divide, calc):
    return input_sum / divide * calc

def reduction(input_sum, answer):
    return input_sum - answer

input_sum = float(raw_input("\nEnter sum total: "))

calc = float(raw_input("\nEnter Percentage: "))

answer = percentage(input_sum, 100, calc)

reduction_total = reduction(input_sum, answer)

print "\nYou are left with £{0:.2f}\n".format (reduction_total)

Making Decisions in Python

This is a short script that shows how to use if as well as elif and else so that Python can make decisions based on the input it is given.

people = 100
cars = 30
buses = 15

if cars > people:
    print "We should take the cars."
elif cars < people:
    print "We should not take the cars."
else:
    print "We can't decide."


if buses > cars:
    print "That's too many buses."
elif buses < cars:
    print "Maybe we could take the buses."
else:
    print "We still can't decide"


if people > buses:
    print "Alright, let's just take the buses."
else:
    print "Fine. Let's stay home then."

How Rice crippled the Japanese Navy

There is a great article this month in Atlas Obscura detailing how fine, polished white rice helped destroy the Japanese navy and upset most of the residents of Tokyo.

Gleaming white rice was a status symbol—it was expensive and laborious to husk, hull, polish, and wash. In Japan, the poor ate brown rice, or other carbohydrates such as sweet potatoes or barley. The rich ate polished white rice, often to the exclusion of other foods.

In his book Beriberi in Modern Japan: The Making of a National Disease, Alexander R. Bay describes the efforts of Edo-era doctors to figure out the disease. A common suspect was dampness and damp ground. One doctor administered herbal medicines and a fasting regimen to a samurai, who died within months. Other doctors burned dried mugwort on patients’ bodies to stimulate qi and blood flow.

Memorizing Logic

Today, I will start trying to memorise the Truth Terms. Basically if something is true or false. These symbols forms combinations to tell Python what to do in a given situation. Now it's just a case of making them stick in my mind. Most of them seem fairly self-explanatory.

and

or

not

!= (not equal)

== (equal)

>= (greater than equal)

<= (less than equal)

True

False

Adding

I wrote a simple script for adding that uses a function to hold two variables and then add them together. You create a function by using def and then giving it a name.

# -*- coding: utf-8 -*-

def add(value_1, value_2):
    print "Adding %d and %d together." % (value_1, value_2)
    return value_1 + value_2

cost = add(2345,1234)

print "The cost is: £{0:.2f}".format (cost)

Be sure to use the utf-8 value at the top or else Python will not understand the currency character.

Dedekind Cut - Tahoe

Great new album from Lee Bannon. Tahoe has huge, cinematic sweeps often accompanied by feelings of sadness or unresolved strife. A really excellent addition, if you're into atmospheric ambient works.

Calculating Time

Simple script to calculate days between two dates.

from datetime import *

today = date.today()
past_date = date(1994,2,10)
diff = today - past_date
print "That was %d days ago." % diff.days

I don't understand the need for the asterisk on the first line.

Terekke - Improvisational Loops

Pure 80s ambient style bliss now available on the Music From Memory label. You can order it here.

Revision

Going through the first twenty exercises once again. It will not become second-nature if I do not build revision into my learning. The trick is to make the revisions enjoyable.

The Nightcrawlers - The Biophonic Boombox Recordings

Anthology Recordings is set to issue a collection of recordings from Philadelphia / New Jersey experimental synth group The Nightcrawlers—a trio comprised of brothers Tom and Peter Gulch and Dave Lunt.

Titled The Biophonic Boombox Recordings, the release will be the group's first ever retrospective and features cuts pulled from over 40 cassette tapes that the trio released from 1979 to the early '90s under their Synkronos Music label imprint. 

These early electronic explorations drew influence from the cosmic minimalism of the Berlin School (Klaus Schulze / Tangerine Dream) and other European pioneers (Cluster / Popul Vuh) and were recorded straight into the mic of a JVC Biphonic Boombox as fully improvised performances.

It's available on the 23rd February from here.