Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- task: int = int(input("ведите номер задачи "))
- if task == 1:
- import math
- x = int(input("Введите x "))
- h = int(input("Введите n(точность), до которого надо считать сумму ряда "))
- i = 1
- s = 1
- n = x
- x=x*x
- mn=-1
- while i < h:
- if i//2==0:
- mn=1
- else: mn=-1
- s = s + (mn * x)/math.factorial(2*i+1)
- x = x * n * n
- i = i + 1
- print(s)
- elif task == 2:
- string = input("Введите строкy из более чем 10 символов ")
- while len(string) < 10:
- string = input("Введите строке из более чем 10 символов ")
- else:
- print(string[:4])
- print(string[-4:])
- print(string[len(string) // 2])
- print([string[2:7]])
- elif task == 3:
- a = input("Введите список из 6 элементов ")
- a.split(',')
- while len(a.split(',')) != 6:
- a = input("Введите список из 6 элементов ")
- else:
- l = 0
- m = 0
- print(a.split(',')[3])
- while l < 6:
- m += int(a.split(',')[l])
- print(a.split(',')[5 - l])
- l += 1
- print(m)
- print(m / 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement