You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

day6a.py 339B

12345678910111213
  1. def main():
  2. with open("input6.txt") as file:
  3. text = file.read()
  4. groups = text.split("\n\n")
  5. print(f"I have {len(groups)} groups.")
  6. count = 0
  7. for grp in groups:
  8. sgrp = set(grp.replace("\n", ""))
  9. count += len(sgrp)
  10. print(f"The total is {count}.")
  11. if __name__ == "__main__":
  12. main()