1)
N = 8
array = [random.randint(0,10) for i in range(N)]
print(array)
array = [i * i for i in array]
2)
N = 10
array = [random.randint(100,300) for i in range(N)]
array = [i//10%10 for i in array]
3)
sum = 0
arr_sum = []
array = [str(random.randint(100,500)) for i in range(N)]
for j in array:
for i in j:
sum += int(i)
arr_sum.append(sum)
print(arr_sum)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1)
N = 8
array = [random.randint(0,10) for i in range(N)]
print(array)
array = [i * i for i in array]
print(array)
2)
N = 10
array = [random.randint(100,300) for i in range(N)]
print(array)
array = [i//10%10 for i in array]
print(array)
3)
N = 10
sum = 0
arr_sum = []
array = [str(random.randint(100,500)) for i in range(N)]
print(array)
for j in array:
for i in j:
sum += int(i)
arr_sum.append(sum)
sum = 0
print(arr_sum)
Главное в программе 100 и 500 стоит