помогите пожалуйста, задачи нужно решить на пайтоне
Ответы
Ответ:
1)
counter_positive = 0
counter_negative = 0
n = int(input())
for i in range(n):
tmp = int(input())
if tmp > 0:
counter_positive += 1
elif tmp < 0:
counter_negative += 1
print("Положительных: " + str(counter_positive) + "\nОтрицательных = " + str(counter_negative))
10
5
-5
5
-5
-10
100
-4
0
0
0
Положительных: 3
Отрицательных = 4
2.1) (Вариант без списка)
n = int(input())
list1 = []
counter_mod5 = 0
for i in range(n):
elem = random.randint(1, 9000)
if (elem % 10 == 0) and (elem % 5 == 0):
print(elem)
counter_mod5 += 1
print()
print(counter_mod5)
2.2) (Вариант со списком)
n = int(input())
list1 = []
counter_mod5 = 0
for i in range(n):
list1.append(random.randint(1, 9000))
for elem in list1:
if (elem % 10 == 0) and (elem % 5 == 0):
print(elem)
counter_mod5 += 1
print()
print(counter_mod5)
10
4090
3110
2
Объяснение:
1) https://pastebin.com/WbkrSKE7
2) https://pastebin.com/A2qEN5hD