\n
- это escape-последовательность. Они нужны для символов, которые невозможно записать в строку иначе. Соответственно, пробелу escape-последовательность не нужна и её нет. const mustStay = arr => arr.every(n => n.value !== '-');
const newArr = arr.filter(mustStay);
arr.reduceRight((_, n, i, a) => mustStay(n) || a.splice(i, 1), null);
// или
arr.splice(0, arr.length, ...arr.filter(mustStay));
// или
let numDeleted = 0;
for (const [ i, n ] of arr.entries()) {
arr[i - numDeleted] = n;
numDeleted += !mustStay(n);
}
arr.length -= numDeleted;
if (
document.getElementById('apple').style.display == 'none' &&
document.getElementById('shoe').style.display == 'none' &&
document.getElementById('book').style.display == 'none' &&
document.getElementById('purse').style.display == 'none'
) {
document.getElementById('begin').style.display = 'none';
}
class A:
pass
a = A()
a.x = 1
print(a.x, a.__getattribute__('x'))
a.__setattr__('from', 2) # вот же идиотизм
print(a.__getattribute__('from'))
import math
import os
INPUT_FILE = 'input.txt'
OUTPUT_FILE = 'output.txt'
NUMBER_THRESHOLD = 1000
if __name__ == '__main__':
if not os.path.exists(INPUT_FILE) or not os.path.isfile(INPUT_FILE):
raise FileNotFoundError
with open('input.txt') as file:
text = file.read()
if not text:
raise ValueError('File is empty')
try:
a, b, c, *_ = [int(n) for n in text.strip().split(" ") if n.isdigit() and int(n) < NUMBER_THRESHOLD]
except ValueError:
raise ValueError('Wrong input data')
out = ""
if not (a < b + c and b < a + c and c < a + b):
out = "-1"
else:
p = 0.5 * (a + b + c)
h = 2 * math.sqrt(p * (p - a) * (p - b) * (p - c)) / a
out = f'{str(a + b + c)} {("%.5f" % (a * h / 2))}'
with open(OUTPUT_FILE, 'w') as file:
file.write(out)