# This program converts a number of minutes into hours.
m = input("How many minutes should I convert? ")
h = m / 60
print h
null = raw_input("Press ENTER to exit.")
Then I refined it:
# This program converts a number of minutes into hours,
# to two decimal places.
m = input("How many minutes should I convert? ")
h1 = m / 60
dec = (h1) * 60
# This variable compensates for python's inability to float.
h2 = 100 * (m - dec) / (60)
print h1,".",h2
null = raw_input("Press ENTER to exit.")
The final version will have to wait until I learn if-then statements, so that I can display the correct units (hour/s). I suppose I should probably comment that, since I'm more practicing comments than anything else.
# This program converts a number of minutes into hours and minutes
m = input("How many minutes should I convert? ")
h1 = m / 60
dec = (h1) * 60
h2 = m - dec
print h1,"hours, ",h2,"minutes."
null = raw_input("Press ENTER to exit.")
The text I'm teaching myself with is How to Think Like a Computer Scientist, for anyone who's curious.
Hopefully, all this effort will not detract from the time I'm devoting to penning my new sitcom: Chad Thuy, Pad Thai Guy. It's the story of the comic misadventures of a delivery guy who goes on to build an unstoppable empire of Pan-Asian Fast Food restaurants, which he rules with an iron fist. Or will, some day. That's not for a few seasons yet. I'm pitching it to the WB as a sort of Two Guys, a Girl, and a Pizza place meets Sopranos, but with yellow people. And never mind that according to America's one-drop rule I'm black; and not at all Asian, any way you slice it. I mean, Jews have been writing shows for black folks for decades now, right? *rimshot*