FireWolf3000

Edited Python Day

Jan 19th, 2021 (edited)
787
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def generate_extended_periods(day_span, night_span, unit):
  2.     f = open("generate_extended_periods_out.txt", "w")
  3.     if day_span <= 10 or night_span <= 10:
  4.         return
  5.     day_time_to_add = day_span - 10
  6.     night_time_to_add = night_span - 10
  7.     day_increment = 12000 / day_time_to_add * unit
  8.     night_increment = 12000 / night_time_to_add * unit
  9.     current_day_time = 0
  10.     while current_day_time < 12000:
  11.         f.write(f"{current_day_time:.0f}" + " " + f"{unit}\n")
  12.         current_day_time += day_increment
  13.     current_night_time = 0
  14.     while current_night_time < 12000:
  15.         f.write(f"{(12000 + current_night_time):.0f}" + " " + f"{unit}\n")
  16.         current_night_time += night_increment
  17.     f.close()
  18.     return
  19.  
  20. generate_extended_periods(20.0, 10.5, 0.01)
RAW Paste Data