1)
number_list = [int(input()) for n in range(4)]
amount = 0
for i in number_list:
amount += i
print(amount)
3)
number_list = []
n = 0
for i in range(100, 1, -1):
if i % 19 == 0:
number_list.append(i)
n += 1
if n == 15:
break
print(number_list)
4)
number = str(input())
number_list = [i for i in number]
eight_list = []
if number_list.count('8') == 0:
print('0')
else:
print(number_list.index('8') + 1)
5)
number_list = [n for n in number]
amount += int(i)
if amount > 10:
print('Верно .')
print('Не верно .')
#include <iostream>
#include <iomanip>
int main()
{
const double eps = 0.00001;
double x, x0, xk, h, a, s;
int n, i, k;
setlocale(LC_ALL, "Russian");
std::cout << "Введите x0: ";
std::cin >> x0;
std::cout << "Введите xk: ";
std::cin >> xk;
h = 0.1;
x = x0 - h;
n = round((xk - x0) / h) + 1;
std::cout << "№ x S(x) y(x)" << std::endl;
for (i = 0; i < n; i++)
x += h;
a = 1; s = a; k = 0;
while (abs(a) > eps)
a = -a * 2 * x / (2.0 * k + 1) / (2.0 * k + 2);
s += a;
k++;
}
std::cout << i << std::setw(5);
std::cout << x << std::setprecision(5) << std::setw(12);
std::cout << s << std::setprecision(5) << std::setw(12);
std::cout << cos(sqrt(2 * x)) << std::setprecision(5) << std::endl;
return 0;
1)
number_list = [int(input()) for n in range(4)]
amount = 0
for i in number_list:
amount += i
print(amount)
3)
number_list = []
n = 0
for i in range(100, 1, -1):
if i % 19 == 0:
number_list.append(i)
n += 1
if n == 15:
break
print(number_list)
4)
number = str(input())
number_list = [i for i in number]
eight_list = []
if number_list.count('8') == 0:
print('0')
else:
print(number_list.index('8') + 1)
5)
number = str(input())
number_list = [n for n in number]
amount = 0
for i in number_list:
amount += int(i)
if amount > 10:
print('Верно .')
else:
print('Не верно .')
#include <iostream>
#include <iomanip>
int main()
{
const double eps = 0.00001;
double x, x0, xk, h, a, s;
int n, i, k;
setlocale(LC_ALL, "Russian");
std::cout << "Введите x0: ";
std::cin >> x0;
std::cout << "Введите xk: ";
std::cin >> xk;
h = 0.1;
x = x0 - h;
n = round((xk - x0) / h) + 1;
std::cout << "№ x S(x) y(x)" << std::endl;
for (i = 0; i < n; i++)
{
x += h;
a = 1; s = a; k = 0;
while (abs(a) > eps)
{
a = -a * 2 * x / (2.0 * k + 1) / (2.0 * k + 2);
s += a;
k++;
}
std::cout << i << std::setw(5);
std::cout << x << std::setprecision(5) << std::setw(12);
std::cout << s << std::setprecision(5) << std::setw(12);
std::cout << cos(sqrt(2 * x)) << std::setprecision(5) << std::endl;
}
return 0;
}