Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. task: int = int(input("ведите номер задачи "))
  2. if task == 1:
  3. import math
  4.  
  5. x = int(input("Введите x "))
  6. h = int(input("Введите n(точность), до которого надо считать сумму ряда "))
  7. i = 1
  8. s = 1
  9. n = x
  10. x=x*x
  11. mn=-1
  12. while i < h:
  13. if i//2==0:
  14. mn=1
  15. else: mn=-1
  16. s = s + (mn * x)/math.factorial(2*i+1)
  17. x = x * n * n
  18. i = i + 1
  19.  
  20. print(s)
  21. elif task == 2:
  22. string = input("Введите строкy из более чем 10 символов ")
  23. while len(string) < 10:
  24. string = input("Введите строке из более чем 10 символов ")
  25. else:
  26. print(string[:4])
  27. print(string[-4:])
  28. print(string[len(string) // 2])
  29. print([string[2:7]])
  30. elif task == 3:
  31. a = input("Введите список из 6 элементов ")
  32. a.split(',')
  33. while len(a.split(',')) != 6:
  34. a = input("Введите список из 6 элементов ")
  35. else:
  36. l = 0
  37. m = 0
  38. print(a.split(',')[3])
  39. while l < 6:
  40. m += int(a.split(',')[l])
  41. print(a.split(',')[5 - l])
  42. l += 1
  43. print(m)
  44. print(m / 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement