Advertisement
greatbn

Adam's Chocolate

Mar 16th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. bars = 0
  2. days = 0
  3. bar_in_day = 0
  4. bar_in_month = 0
  5. bar_in_year = 0
  6. import math
  7. for month in range(1,13):
  8.     if month == 1 or month ==3 or month == 5 or month == 7 or month == 8 or month == 10 or month ==12:
  9.         days = 31
  10.     elif month == 4 or month == 6 or month == 9 or month == 11:
  11.         days = 30
  12.     elif month == 2:
  13.         days = 29
  14.     for day in range(1,days+1):
  15.         bar_in_day = day%10 + day%10 + month%10 + month/10+2+0+1+6
  16.         if (math.sqrt(bar_in_day) - int(math.sqrt(bar_in_day))) == 0 or ((bar_in_day)**(1./3) - int((bar_in_day)**(1./3))) == 0:
  17.             bar_in_day = 0 
  18.         bar_in_month = bar_in_month + bar_in_day
  19.     print "Bars sold in month "+str(month)+": "+str(bar_in_month)
  20.     bar_in_year = bar_in_year + bar_in_month
  21. print "Bars sold in year 2016: "+str(bar_in_year- (2+4+1+2+2+0+1+6))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement