Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advent of Code
#18
\n is not a separator. \n is a linefeed or newline character. Every line in the file except the last has a \n tacked on at the end. The separator for this program is a blank line. When the file has a blank line the string is "\n" (blank followed linefeed).

Why are you asking now? This is exactly what you've been doing from the very start. If the line is not blank, convert line to number and do something with the result. Originally you were appending to a long list. Now you are adding to a total.
Reply


Messages In This Thread
Advent of Code - by astral_travel - Dec-05-2022, 06:36 PM
RE: Advent of Code - by deanhystad - Dec-05-2022, 06:48 PM
RE: Advent of Code - by astral_travel - Dec-05-2022, 06:49 PM
RE: Advent of Code - by rob101 - Dec-05-2022, 07:07 PM
RE: Advent of Code - by deanhystad - Dec-05-2022, 07:31 PM
RE: Advent of Code - by astral_travel - Dec-05-2022, 08:09 PM
RE: Advent of Code - by astral_travel - Dec-05-2022, 07:53 PM
RE: Advent of Code - by deanhystad - Dec-05-2022, 08:08 PM
RE: Advent of Code - by astral_travel - Dec-05-2022, 08:12 PM
RE: Advent of Code - by deanhystad - Dec-05-2022, 08:40 PM
RE: Advent of Code - by astral_travel - Dec-05-2022, 09:06 PM
RE: Advent of Code - by snippsat - Dec-05-2022, 09:41 PM
RE: Advent of Code - by deanhystad - Dec-05-2022, 09:50 PM
RE: Advent of Code - by snippsat - Dec-05-2022, 09:58 PM
RE: Advent of Code - by astral_travel - Dec-05-2022, 10:06 PM
RE: Advent of Code - by deanhystad - Dec-05-2022, 11:49 PM
RE: Advent of Code - by astral_travel - Dec-06-2022, 04:47 PM
RE: Advent of Code - by deanhystad - Dec-06-2022, 05:10 PM
RE: Advent of Code - by astral_travel - Dec-06-2022, 05:37 PM
RE: Advent of Code - by deanhystad - Dec-06-2022, 05:37 PM
RE: Advent of Code - by astral_travel - Dec-06-2022, 05:54 PM
RE: Advent of Code - by deanhystad - Dec-06-2022, 06:27 PM
RE: Advent of Code - by astral_travel - Dec-06-2022, 06:50 PM
RE: Advent of Code - by deanhystad - Dec-06-2022, 07:38 PM
RE: Advent of Code - by snippsat - Dec-06-2022, 07:50 PM
RE: Advent of Code - by astral_travel - Dec-06-2022, 08:41 PM
RE: Advent of Code - by deanhystad - Dec-06-2022, 09:19 PM
RE: Advent of Code - by astral_travel - Dec-06-2022, 09:35 PM
RE: Advent of Code - by deanhystad - Dec-06-2022, 09:53 PM
RE: Advent of Code - by astral_travel - Dec-07-2022, 05:14 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020