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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -