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.

4 jaren geleden
4 jaren geleden
12345678910111213141516
  1. def checks1(string):
  2. yield len(re.findall(r'([aeiou])', string)) >= 3
  3. yield len(re.findall(r'(.)\1', string))
  4. yield len(re.findall(r'(ab|cd|pq|xy)', string)) == 0
  5. def checks2(string):
  6. yield len(re.findall(r'(.)(.).*\1\2', string)) >= 1
  7. yield len(re.findall(r'(.).\1', string)) >= 1
  8. ans1 = 0
  9. ans2 = 0
  10. for line in data_file.read_text().splitlines():
  11. ans1 += all(checks1(line))
  12. ans2 += all(checks2(line))