python - While loops in Procedures -
i trying output 1 30 days isn't working , says code didn't display output
here code:
def nextday(year, month, day): day = 0 while (day < 30): day = day + 1 print day
this having me do. stuck on day portion. sorry noticed put month instead of day fixed it, trying @ end.
define simple nextday procedure, assumes every month has 30 days.
for example:
nextday(1999, 12, 30) => (2000, 1, 1) nextday(2013, 1, 30) => (2013, 2, 1) nextday(2012, 12, 30) => (2013, 1, 1) (even though december has 31 days) def nextday(year, month, day): """ returns year, month, day of next day. simple version: assume every month has 30 days. """ # code here return
well if you're trying output 1 through 30 work...
for x in range(1, 31): print 'day: %d' % x
i literally don't function @ all, makes no sense.
in addition, don't why use while loop slower both range , xrange.
Comments
Post a Comment