Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- min_function()
- y_function()
- sum_function()
- sum_of_multiplication()
- tabulation()
- print(find_index_of_last_7())
- count_negative_numbers()
- def min_function():
- print("Введите x, y, z через пробел:")
- x, y, z = map(int, input().split())
- minimum = x if x < y and x < z else (y if y < z else z)
- print(f"Min of x, y, z = {minimum}\n")
- def y_function():
- print("Введіть у з клавіатури:")
- y = int(input())
- y_result = 5 * y if y >= 0 else 0
- print(f"y = {y_result}\n")
- def sum_function():
- print("Введите n")
- n = int(input())
- total_sum = 0
- for i in range(1, n + 1):
- total_sum += i / (i + 3)
- print(f"Сумма = {total_sum}\n")
- def sum_of_multiplication():
- print("Введите n")
- n = int(input())
- total_sum = 1
- for i in range(1, n + 1):
- total_sum *= (i + 3) / (factorial(i) + 2)
- print(f"Сумма при умножении = {total_sum}\n")
- def factorial(num):
- result = 1
- for i in range(1, num + 1):
- result *= i
- return result
- def tabulation():
- start_x = -3.0
- end_x = 3.0
- step = 0.5
- print("x\t y")
- print("--------------")
- x = start_x
- while x <= end_x:
- y = x * x - 1
- print(f"{x}\t{y}")
- x += step
- print()
- def find_index_of_last_7():
- print("Введите n")
- n = input()
- reversed_str = n[::-1]
- for index, char in enumerate(reversed_str):
- if char == '7':
- return f"Порядковый номер последней цифры 7 с конца: {index}"
- return "Цифра 7 не найдена"
- def count_negative_numbers():
- print("Введите n")
- n = int(input())
- negative_count = 0
- for i in range(1, n + 1):
- number = int(input(f"Введите число a{i}: "))
- if number < 0:
- negative_count += 1
- print(f"Количество отрицательных чисел в последовательности: {negative_count}")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment