Newbie! I'm a newbie! What's wrong with this program?

Lee Harr missive at frontiernet.net
Mon Jul 21 00:56:03 CEST 2003

```> import math ##loads the math modual
> ########Start created Functions#########
> ##Function for converting minutes to hours##
> def minHour(x):
>   min = 60
>   hour = min * x
>   print hour
> ##Function creates a new line##
> def newLine():
>   print
> #######End created Functions########
> ###Start Variables####
> x_hours = 5
> ###End Variables####
> newLine();
> print "There are", minHour(x_hours), "minutes in", x_hours, "hours";
> newLine();
> print "Program Terminated.";
> newLine();

# mi.py
import math
import sys

def minutes_per_hour(hours):
MIN_PER_HOUR = 60
return hours * MIN_PER_HOUR

def print_minutes(hours):
minutes = minutes_per_hour(hours)
print "There are %s minutes in %s hours" % (minutes, hours)
print

if __name__ == '__main__':
hours = float(sys.argv[1])
print_minutes(hours)
#

>python mi.py 5.2
There are 312.0 minutes in 5.2 hours

>python mi.py 5
There are 300.0 minutes in 5.0 hours

>python mi.py 5.25
There are 315.0 minutes in 5.25 hours

```