Dastur natijasi:
6.Quicksort algoritmi asosida yechilgan dastur
random matrix generator
random matritsa yaratish uchun python dasturida random bizga kerak bo’ladi va biz uni import qilib olamiz
Dastur kodi:
import random
r = int(input("Qatorlar sonini kiriting"))
c = int(input("ustunlar sonini kiriting"))
matritsa = []
for i in range(r):
a = []
for j in range(c):
k = random.randint(1 , 30 )
a.append(k)
matritsa.append(a)
for i in range(r):
for j in range(c):
print(matritsa[i][j] , end = " ")
print()
Dastur natijasi:
7.Random orqali 1 dan 30 gacha sonlar va 5 ta qator va 4ta ustunli ixtiyoriy matritsa
Do'stlaringiz bilan baham: |