Asqaraliyev Islomjon 111 20-g
Download 82.67 Kb.
|
Asqaraliyev Islomjon 111 20-G P 2-M
Asqaraliyev Islomjon 111 20-g. 2-Modul. 3-variantButun sonli A(1:10, 1:10) massivda bir xil elementlar mavjud yoki mavjud emasligini aniqlang. a0=[]
for i in range(0,10,1): a1=int(input("hadini kiriting")) a0.append(a1) for i in range(0,10,1): a2=int(input("hadini kiriting")) a01.append(a2) for i in range(0,10,1): for e in range(0,10,1): if a0[i]==a01[e]: print(a0[i]) aa=[a0,a01] print(aa) N butun soni va haqiqiy sonli B(1:n,1:n) massiv berilgan. Hisoblang: . Bu yerda -B ning i-satridagi eng katta element, -esa B ning j ustunidagi eng kichik element. n=int(input("n ni kiriting")) a0=[] a01=[] Sum=0 for i in range(0,n,1): a1=int(input("hadini kiriting")) a0.append(a1) for i in range(0,n,1): a2=int(input("hadini kiriting")) a01.append(a2) for i in range(0,n,1): Sum+=a0[i]*a01[i] print(Sum) Natural n va m hamda haqiqiy sonli A(1:n,1:m) massiv berilgan. Shu massivning eng katta va eng kichik elementlari joylashgan satrlari o`rinlarini almashtiring. n = int(input("Massivning qatorlar sonini kiriting: ")) m = int(input("Massivning ustunlar sonini kiriting: ")) A = [] for i in range(n): row = input().split() A.append([int(elem) for elem in row]) # Eng katta va eng kichik elementlarni topish max_row = 0 # eng katta elementlar bo'lgan satr indeksi min_row = 0 # eng kichik elementlar bo'lgan satr indeksi max_elem = A[0][0] # massivning eng katta elementi min_elem = A[0][0] # massivning eng kichik elementi for i in range(n): for j in range(m): if A[i][j] > max_elem: max_elem = A[i][j] max_row = i if A[i][j] < min_elem: min_elem = A[i][j] min_row = i # Satrlar o'rinlarini almashtirish A[max_row], A[min_row] = A[min_row], A[max_row] print("Natija: ") for i in range(n): for j in range(m): print(A[i][j], end=' ') print() Download 82.67 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling