Apr-30-2021, 09:36 AM
(Apr-29-2021, 10:43 AM)ibreeden Wrote: How do you try this? Your function does not return anything. I think that is the problem. Your function must return a value and then you must use this return value.
import random def toto(): jp = [] for i in range(4): jp.append(random.randint(1,10)) return jp a = toto() print(a) print(a[0])
Output:[1, 3, 3, 10] 1
many thanks