Paste Search Dynamic
Recent pastes
Given information about monthl
  1. total_inches = 0  
  2. years = int(input("Enter number of years: "))  
  3.  
  4. for i in range(1, years+1, 1):  
  5.     print("Year %d" % i)  
  6.     c = 1  
  7.     while c < 13:  
  8.         try:  
  9.             inches = float(input("Month %d. Enter inches of rainfall: " % c))  
  10.         except valueerror:  
  11.             continue  
  12.         if inches < 0:  
  13.            print("err: inches < 0")  
  14.            continue  
  15.         else:  
  16.            total_inches += inches  
  17.         c += 1  
  18. print("Total number of months %d" % (num_years * 12))  
  19. print("Total rainfall %f" % total_inches)  
  20. print("Average rainfall %f" % (total_inches / (num_years * 12)))
Parsed in 0.012 seconds