vendredi 3 juillet 2020

How to subtract or find the differences from this output?

Beginner here, just a week into Python. So what I'm trying to do is figure out how to find the differences from the output I get. Let's say I got [ 5 8 10 8 11] Now I want to 8-5, 10-8, 8-10, 11-8. How do I achieve that? enlighten me.

import numpy as np
import random
ll = list(range(5))

a = np.array(range(5))

b = np.array(random.choices(ll, k=5))

c = np.array([5])

print(a+b+c)



Aucun commentaire:

Enregistrer un commentaire