Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################
- NAZWA_PLIKU = 'plik.txt'
- #opcjonalnie
- STARTUJ_OD_WIERSZA_NUMER = 1
- ######################################
- from re import findall, compile
- ctn = ''
- with open(NAZWA_PLIKU, 'r') as fd:
- ctn = fd.read().replace(',', '.').splitlines()
- pattern = compile(r'([\[|(])([\d\.]+);([\d\.]+)([\]|)])')
- for x in range(STARTUJ_OD_WIERSZA_NUMER - 1, len(ctn)):
- fa = findall(pattern, ctn[x])
- l1 = float(input(f'Podaj pierwsza liczbe dla wiersza nr {x+1}: ').replace(',', '.'))
- l2 = float(input(f'Podaj druga liczbe dla wiersza nr {x+1}: ').replace(',', '.'))
- if eval(f"l1 {('>=' if fa[0][0] == '[' else '>')} float(fa[0][1]) and l1 {('<=' if fa[0][3] == ']' else '<')} float(fa[0][2])") \
- and \
- eval(f"l2 {('>=' if fa[1][0] == '[' else '>')} float(fa[1][1]) and l2 {('<=' if fa[1][3] == ']' else '<')} float(fa[1][2])"):
- print(ctn[x].strip()[-1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement