I just started coding in python and I have a question: I would like to take the randomized numbers of the first column of my array, find their absolute values, and store them in my second column. So far i've got this:
import random nb = int(input("Enter a number : ")) tab = [[random.randint(-10, 10) for i in range(nb)], []] print(','.join(str(n) for n in tab))
Thanks in advance !
Aucun commentaire:
Enregistrer un commentaire