I just started to programming so i'm a begynner. I'm going to make an array of random number between -1 and 1 and then sort them without using sort function.
from random import* x = uniform(-1,1)
this i did for singel random number
and for sorting without using sort function:
a = [5, 2, 4, 1] for i in range(len(a)): for j in range(len(a) - 1): if a[j] > a[j+1]: t = a[j] a[j] = a[j+1] a[j] = t
print a
but i don't know how i should find a[], because the first step for generating random number give me a single number, and i want to have an array of this generation.
enter code here
Aucun commentaire:
Enregistrer un commentaire