Guruh talabasi Xodjamberdiyev Dilshod Python basics va oop fanidan 3-modulga qushimcha Kodi


Download 111.56 Kb.
Sana14.05.2023
Hajmi111.56 Kb.
#1459492
Bog'liq
3-modulga qushimcha


111-20 guruh talabasi Xodjamberdiyev Dilshod
Python basics va oop fanidan
3-modulga qushimcha
Kodi:
matrix = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]

# Birinchi uslub:


print("1. satr bo'yicha:")
for i in range(5):
for j in range(5):
print(matrix[i][j], end=" ")
print()

print("2. ustun bo'yicha:")


# Ikkinchi uslub:
for i in range(5):
for j in range(5):
print(matrix[j][i], end=" ")
print()

# Barcha elementlar ketma-ketligi


result = []
for i in range(5):
for j in range(5):
result.append(matrix[i][j])

print(result)



Natija:

Download 111.56 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling