4-2 fertig

This commit is contained in:
2024-01-01 22:41:12 +01:00
parent 0ea6ce43e5
commit d048984091
4 changed files with 1071 additions and 0 deletions

30
04/04-1.py Normal file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
data = []
# parse input
input_file = open("input", "r")
for line in input_file:
line = line.strip()
line = line.replace(",", "-").split("-")
tt = []
for t in line:
tt.append(int(t))
data.append(tt)
input_file.close()
def a_is_b(a1, a2, b1, b2):
if a1 >= b1 and a2 <= b2:
print(a1, a2, b1, b2)
return True
return False
counter = 0
for d in data:
if a_is_b(d[0], d[1], d[2], d[3]) or a_is_b(d[2], d[3], d[0], d[1]):
# print(d)
counter += 1
print("Lösung:", counter)